Skip to content

Commit

Permalink
Fix crash when AlphaImage is an empty SHP
Browse files Browse the repository at this point in the history
  • Loading branch information
Rampastring committed Jan 22, 2025
1 parent f09aacf commit 1453679
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/TSMapEditor/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace TSMapEditor
{
public static class Constants
{
public const string ReleaseVersion = "1.4.0";
public const string ReleaseVersion = "1.4.1";

public static int CellSizeX = 48;
public static int CellSizeY = 24;
Expand Down
9 changes: 8 additions & 1 deletion src/TSMapEditor/Rendering/MapView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1624,7 +1624,14 @@ private void DrawWorld()

for (int i = 0; i < alphaImagesToRender.Count; i++)
{
var alphaTexture = alphaImagesToRender[i].AlphaImage.GetFrame(0);
var alphaShape = alphaImagesToRender[i].AlphaImage;
if (alphaShape.GetFrameCount() <= 0)
continue;

var alphaTexture = alphaShape.GetFrame(0);
if (alphaTexture == null)
continue;

var pixelPoint = EditorState.Is2DMode ? CellMath.CellCenterPointFromCellCoords(alphaImagesToRender[i].Point, Map) :
CellMath.CellCenterPointFromCellCoords_3D(alphaImagesToRender[i].Point, Map);
var alphaDrawRectangle = new Rectangle(pixelPoint.X - alphaTexture.ShapeWidth / 2 + alphaTexture.OffsetX,
Expand Down

0 comments on commit 1453679

Please sign in to comment.