Skip to content

Commit

Permalink
fix(zq): crash on reducing map count
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilyV99 committed Apr 6, 2024
1 parent 702396d commit ba8f2df
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/zq/zq_class.cpp
Expand Up @@ -168,8 +168,8 @@ void zmap::clear()
void zmap::force_refr_pointer()
{
if(unsigned(currmap) > map_count || (currmap*MAPSCRS > TheMaps.size()))
screens = &TheMaps[currmap*MAPSCRS];
else screens = nullptr;
screens = nullptr;
else screens = &TheMaps[currmap*MAPSCRS];
}
bool zmap::CanUndo()
{
Expand Down Expand Up @@ -6404,6 +6404,7 @@ bool setMapCount2(int32_t c)
return false;
}

bound(currmap,0,c-1);
if(map_count>oldmapcount)
{
for(int32_t mc=oldmapcount; mc<map_count; mc++)
Expand All @@ -6415,9 +6416,11 @@ bool setMapCount2(int32_t c)
Map.clearscr(ms);
}
}
Map.setCurrMap(currmap);
}
else
{
Map.setCurrMap(currmap);
if(!layers_valid(Map.CurrScr()))
fix_layers(Map.CurrScr(), false);

Expand All @@ -6430,8 +6433,6 @@ bool setMapCount2(int32_t c)
}
}

Map.setCurrMap(bound(currmap,0,c-1));

return true;
}

Expand Down

0 comments on commit ba8f2df

Please sign in to comment.