From 534e0aae81261990c1160378a085e2aeac9a6b7a Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 16 Jul 2024 15:21:59 -0400 Subject: Fixed undefined behavior in GetRealSubwayDoor --- src/subway_map.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/subway_map.cpp') diff --git a/src/subway_map.cpp b/src/subway_map.cpp index 044e6fa..9bfedf9 100644 --- a/src/subway_map.cpp +++ b/src/subway_map.cpp @@ -19,7 +19,6 @@ enum class ItemDrawType { kNone, kBox, kOwl }; namespace { std::optional GetRealSubwayDoor(const SubwayItem subway_item) { - std::optional subway_door = subway_item.door; if (AP_IsSunwarpShuffle() && subway_item.sunwarp && subway_item.sunwarp->type != SubwaySunwarpType::kFinal) { int sunwarp_index = subway_item.sunwarp->dots - 1; @@ -29,12 +28,12 @@ std::optional GetRealSubwayDoor(const SubwayItem subway_item) { for (const auto &[start_index, mapping] : AP_GetSunwarpMapping()) { if (start_index == sunwarp_index || mapping.exit_index == sunwarp_index) { - subway_door = GD_GetSunwarpDoors().at(mapping.dots - 1); + return GD_GetSunwarpDoors().at(mapping.dots - 1); } } - - return subway_door; } + + return subway_item.door; } } // namespace -- cgit 1.4.1