From 826a380710261961eb339d12d44f1c45fc384131 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 2 Dec 2023 16:36:11 +0000 Subject: Handle the case where the ray never enters the map --- game/geoData.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'game/geoData.cpp') diff --git a/game/geoData.cpp b/game/geoData.cpp index 6c6f1df..e2b7f66 100644 --- a/game/geoData.cpp +++ b/game/geoData.cpp @@ -232,7 +232,11 @@ GeoData::walkUntil(const PointFace & from, const GlobalPosition2D to, const std: { auto f = from.face(this); if (!f.is_valid()) { - f = opposite_face_handle(findEntry(from.point, to)); + const auto entryEdge = findEntry(from.point, to); + if (!entryEdge.is_valid()) { + return; + } + f = opposite_face_handle(entryEdge); } FaceHandle previousFace; while (f.is_valid() && !op(f)) { -- cgit v1.2.3