Skip to content

Commit 967f9b5

Browse files
authored
Prevent segfault from teleport trap (#82611)
Prevents segfault when a monster steps on a teleport trap and gets teleported outside the map bubble. When a monster gets teleported outside the map bubble, a temporary map is created for the destination, in `teleport::teleport_to_point`. Previously, the reference to this temporary map got lost in the lambda being modified by this commit, since the lambda was `static` and thus retained the reference to the map from where it was first invoked.
1 parent 873d5be commit 967f9b5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/map.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8899,7 +8899,7 @@ void map::spawn_monsters_submap_group( const tripoint_rel_sm &gp, mongroup &grou
88998899
ignore_sight = true;
89008900
}
89018901

8902-
static const auto allow_on_terrain = [&]( const tripoint_bub_ms & p ) {
8902+
const auto allow_on_terrain = [&]( const tripoint_bub_ms & p ) {
89038903
// TODO: flying creatures should be allowed to spawn without a floor,
89048904
// but the new creature is created *after* determining the terrain, so
89058905
// we can't check for it here.

0 commit comments

Comments
 (0)