Skip to content

Commit

Permalink
fix(zq): Crash on changing map count
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilyV99 authored and connorjclark committed Dec 2, 2023
1 parent 6d78a15 commit 92c1902
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/zq/zq_class.cpp
Expand Up @@ -162,7 +162,12 @@ void zmap::clear()
{
*this = zmap();
}

void zmap::force_refr_pointer()
{
if(unsigned(currmap) > map_count || (currmap*MAPSCRS > TheMaps.size()))
screens = &TheMaps[currmap*MAPSCRS];
else screens = nullptr;
}
bool zmap::CanUndo()
{
return undo_stack.size() > 0;
Expand Down Expand Up @@ -6368,6 +6373,7 @@ bool setMapCount2(int32_t c)
try
{
TheMaps.resize(c*MAPSCRS);
Map.force_refr_pointer();
map_autolayers.resize(c*6);
}
catch(...)
Expand Down
1 change: 1 addition & 0 deletions src/zq/zq_class.h
Expand Up @@ -195,6 +195,7 @@ class zmap
zmap();
~zmap();
void clear();
void force_refr_pointer();
bool CanUndo();
bool CanRedo();
bool CanPaste();
Expand Down

0 comments on commit 92c1902

Please sign in to comment.