Skip to content

Commit

Permalink
fixed crash in map editor if .placements where not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsndk committed Jul 27, 2024
1 parent 94303e3 commit a40d50a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions utility/htmls/map_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1118,16 +1118,18 @@ function redraw_map()

to_delete=[]; deleted=false;

for(var i=0;i<map_data.placements.length;i++)
{
var tile=map_data.placements[i];
try{
if(!is_nun(tile[3])) place_area(tile[0],tile[1],tile[2],tile[3],tile[4],"yes");
else place_tile(tile[0],tile[1],tile[2],"yes");
}catch(e)
if (map_data.placements) {
for(var i=0;i<map_data.placements.length;i++)
{
console.log("Faulty tile detected + deleted"); deleted=true;
to_delete.push(i);
var tile=map_data.placements[i];
try{
if(!is_nun(tile[3])) place_area(tile[0],tile[1],tile[2],tile[3],tile[4],"yes");
else place_tile(tile[0],tile[1],tile[2],"yes");
}catch(e)
{
console.log("Faulty tile detected + deleted"); deleted=true;
to_delete.push(i);
}
}
}

Expand Down

0 comments on commit a40d50a

Please sign in to comment.