Skip to content

Commit

Permalink
Fix crash when attempting to draw a base node for a building that has…
Browse files Browse the repository at this point in the history
… a bib with an empty first frame
  • Loading branch information
Rampastring committed Feb 29, 2024
1 parent e741426 commit 8c31bef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/TSMapEditor/Rendering/MapView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 8c31bef

Please sign in to comment.