diff --git a/website/src/lib/db.ts b/website/src/lib/db.ts index 742d5606..1ce5d3cc 100644 --- a/website/src/lib/db.ts +++ b/website/src/lib/db.ts @@ -513,7 +513,7 @@ export const dbUtils = { }); }, reverseSelection: () => { - if (!get(selection).hasAnyChildren(new ListRootItem(), true, ['waypoints'])) { + if (!get(selection).hasAnyChildren(new ListRootItem(), true, ['waypoints']) || get(gpxStatistics).local.points?.length <= 1) { return; } applyGlobal((draft) => { @@ -1053,6 +1053,10 @@ export const dbUtils = { } }); + if (points.length === 0) { + return; + } + getElevation(points).then((elevations) => { applyGlobal((draft) => { applyToOrderedSelectedItemsFromFile((fileId, level, items) => {