From 8c31bef1c7e53f224297da724aecedab11916c13 Mon Sep 17 00:00:00 2001 From: Rampastring Date: Fri, 1 Mar 2024 01:40:11 +0200 Subject: [PATCH] Fix crash when attempting to draw a base node for a building that has a bib with an empty first frame --- src/TSMapEditor/Rendering/MapView.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TSMapEditor/Rendering/MapView.cs b/src/TSMapEditor/Rendering/MapView.cs index 4da0e060..a24d37ac 100644 --- a/src/TSMapEditor/Rendering/MapView.cs +++ b/src/TSMapEditor/Rendering/MapView.cs @@ -1043,7 +1043,7 @@ private void DrawBaseNode(GraphicalBaseNode graphicalBaseNode) int yDrawOffset = Constants.CellSizeY / -2; int frameIndex = 0; - if ((graphics == null || graphics.GetFrame(frameIndex) == null) && bibGraphics == null) + if ((graphics == null || graphics.GetFrame(frameIndex) == null) && (bibGraphics == null || bibGraphics.GetFrame(0) == null)) { DrawStringWithShadow(iniName, 1, drawPoint.ToXNAVector(), replacementColor, 1.0f); return; @@ -1054,6 +1054,7 @@ private void DrawBaseNode(GraphicalBaseNode graphicalBaseNode) if (bibGraphics != null) { PositionedTexture bibFrame = bibGraphics.GetFrame(0); + texture = bibFrame.Texture; int bibFinalDrawPointX = drawPoint.X - bibFrame.ShapeWidth / 2 + bibFrame.OffsetX + Constants.CellSizeX / 2;