From fff25c6c12001a7a868edd726e31c8cd837dbc37 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 24 Dec 2019 17:48:57 +0100 Subject: [PATCH] made panels without content not crash --- MLEM.Ui/Elements/Panel.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MLEM.Ui/Elements/Panel.cs b/MLEM.Ui/Elements/Panel.cs index 8f56567..452e454 100644 --- a/MLEM.Ui/Elements/Panel.cs +++ b/MLEM.Ui/Elements/Panel.cs @@ -137,14 +137,14 @@ namespace MLEM.Ui.Elements { // if we handle overflow, draw using the render target in DrawUnbound if (!this.scrollOverflow) { base.Draw(time, batch, alpha, blendState, samplerState, matrix); - } else { + } else if (this.renderTarget != null) { // draw the actual render target (don't apply the alpha here because it's already drawn onto with alpha) batch.Draw(this.renderTarget, this.GetRenderTargetArea(), Color.White); } } public override void DrawEarly(GameTime time, SpriteBatch batch, float alpha, BlendState blendState, SamplerState samplerState, Matrix matrix) { - if (this.scrollOverflow) { + if (this.scrollOverflow && this.renderTarget != null) { this.UpdateAreaIfDirty(); // draw children onto the render target batch.GraphicsDevice.SetRenderTarget(this.renderTarget);