mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-26 14:38:34 +01:00
fixed exception when elements get removed from their ui in Update
This commit is contained in:
parent
0541ad342e
commit
79354c444b
1 changed files with 8 additions and 3 deletions
|
@ -888,10 +888,12 @@ namespace MLEM.Ui.Elements {
|
||||||
public virtual void Update(GameTime time) {
|
public virtual void Update(GameTime time) {
|
||||||
this.System.InvokeOnElementUpdated(this, time);
|
this.System.InvokeOnElementUpdated(this, time);
|
||||||
|
|
||||||
foreach (var child in this.GetRelevantChildren())
|
foreach (var child in this.GetRelevantChildren()) {
|
||||||
if (child.System != null)
|
if (child.System != null)
|
||||||
child.Update(time);
|
child.Update(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.System != null)
|
||||||
this.System.Metrics.Updates++;
|
this.System.Metrics.Updates++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -920,9 +922,12 @@ namespace MLEM.Ui.Elements {
|
||||||
batch.Begin(SpriteSortMode.Deferred, blendState, samplerState, depthStencilState, null, effect, mat);
|
batch.Begin(SpriteSortMode.Deferred, blendState, samplerState, depthStencilState, null, effect, mat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// draw content in custom begin call
|
// draw content in custom begin call
|
||||||
this.Draw(time, batch, alpha, blendState, samplerState, depthStencilState, effect, mat);
|
this.Draw(time, batch, alpha, blendState, samplerState, depthStencilState, effect, mat);
|
||||||
|
if (this.System != null)
|
||||||
this.System.Metrics.Draws++;
|
this.System.Metrics.Draws++;
|
||||||
|
|
||||||
if (customDraw) {
|
if (customDraw) {
|
||||||
// end our draw
|
// end our draw
|
||||||
batch.End();
|
batch.End();
|
||||||
|
|
Loading…
Reference in a new issue