Skip to content

Commit

Permalink
Fixed crash on async painting with no default Tileset (#1047)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepnight committed Jan 15, 2024
1 parent 124bcb3 commit 78e2fcf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/electron.renderer/data/def/LayerDef.hx
Original file line number Diff line number Diff line change
Expand Up @@ -467,10 +467,6 @@ class LayerDef {
inline function set_tilePivotX(v) return tilePivotX = dn.M.fclamp(v, 0, 1);
inline function set_tilePivotY(v) return tilePivotY = dn.M.fclamp(v, 0, 1);

public inline function getGridTileColor(tileId:Int) : dn.Col {
return _project.defs.getTilesetDef(tilesetDefUid).getAverageTileColor(tileId);
}


public inline function isAutoLayer() {
return type==IntGrid && tilesetDefUid!=null || type==AutoLayer;
Expand Down
6 changes: 5 additions & 1 deletion src/electron.renderer/data/inst/LayerInstance.hx
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,10 @@ class LayerInstance {


/** TILES *******************/
inline function getGridTileColor(tileId:Int) : dn.Col {
var td = _project.defs.getTilesetDef( getTilesetUid() );
return td!=null ? td.getAverageTileColor(tileId) : White;
}

public function addGridTile(cx:Int, cy:Int, tileId:Null<Int>, flips=0, stack:Bool, useAsyncRender=true) {
if( !isValid(cx,cy) )
Expand All @@ -755,7 +759,7 @@ class LayerInstance {
}

if( useAsyncRender )
asyncPaint(cx,cy, def.getGridTileColor(tileId));
asyncPaint(cx,cy, getGridTileColor(tileId));
}


Expand Down

0 comments on commit 78e2fcf

Please sign in to comment.