Skip to content

Commit

Permalink
Added failsafe to location generation
Browse files Browse the repository at this point in the history
  • Loading branch information
aki665 committed Nov 23, 2024
1 parent ba8ee7d commit 6f673e1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions screens/MapScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ export default function MapScreen({
}
let generatingCoords = true;
let coords = { lat: 0, lon: 0 };
let loopCount = 0;

while (generatingCoords) {
//TODO: Add logic to break out of this loop if in it for too long
Expand All @@ -425,6 +426,8 @@ export default function MapScreen({
value.coords.lon === coords.lon,
);
console.log("Generated unique coordinates?", !generatingCoords);
if (loopCount === 5) generatingCoords = false;
loopCount++;
}

tempTrips.push({ coords, trip, name, id });
Expand Down

0 comments on commit 6f673e1

Please sign in to comment.