Skip to content

Commit 76a2bae

Browse files
committed
Prevent crash in SpriteChange::clear_stay_action when WorldMapSector::current is NULL
Possibly related to #3130 and #3328
1 parent 636d560 commit 76a2bae

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/worldmap/sprite_change.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ SpriteChange::clear_stay_action(bool propagate)
6767
m_in_stay_action = false;
6868

6969
// if we are in a stay_group, also clear all stay actions in this group
70-
if (!m_stay_group.empty() && propagate)
70+
auto sector = WorldMapSector::current();
71+
if (!m_stay_group.empty() && propagate && sector != nullptr)
7172
{
72-
for (SpriteChange& sc : WorldMapSector::current()->get_objects_by_type<SpriteChange>())
73+
for (SpriteChange& sc : sector->get_objects_by_type<SpriteChange>())
7374
{
7475
if (sc.m_stay_group != m_stay_group) continue;
7576
sc.m_in_stay_action = false;

0 commit comments

Comments
 (0)