diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 28132ea81c..7e1e107bf7 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,6 @@ 0.3.4.1+ (in development) ------------------------------------------------------------------------ +- Fix: [#15096] Crash when placing entrances in the scenario editor near the map corner. 0.3.4.1 (2021-07-25) ------------------------------------------------------------------------ diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index c165741480..df129f43f4 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -1412,7 +1412,7 @@ static int32_t footpath_is_connected_to_map_edge_helper(CoordsXYZ footpathPos, i edges = tileElement->AsPath()->GetEdges(); currentTile.direction = direction_reverse(currentTile.direction); - if (!(flags & FOOTPATH_CONNECTED_MAP_EDGE_IGNORE_NO_ENTRY)) + if (!tileElement->IsLastForTile() && !(flags & FOOTPATH_CONNECTED_MAP_EDGE_IGNORE_NO_ENTRY)) { int elementIndex = 1; // Loop over all elements and cull appropriate edges @@ -1422,12 +1422,10 @@ static int32_t footpath_is_connected_to_map_edge_helper(CoordsXYZ footpathPos, i break; if (tileElement[elementIndex].GetType() != TILE_ELEMENT_TYPE_BANNER) { - ++elementIndex; continue; } edges &= tileElement[elementIndex].AsBanner()->GetAllowedEdges(); - ++elementIndex; - } while (!tileElement[elementIndex].IsLastForTile()); + } while (!tileElement[elementIndex++].IsLastForTile()); } // Exclude the direction we came from