diff --git a/Sources/GeoDrawer/GeoDrawer.swift b/Sources/GeoDrawer/GeoDrawer.swift index a43d2cc..8e96a7d 100644 --- a/Sources/GeoDrawer/GeoDrawer.swift +++ b/Sources/GeoDrawer/GeoDrawer.swift @@ -249,7 +249,8 @@ extension GeoDrawer { let added = group.addTaskUnlessCancelled { await Task { return chunk.compactMap { input in - project(input.element).flatMap { OffsettedElement(offset: input.offset, element: $0) } + guard !Task.isCancelled, let projected = project(input.element) else { return nil } + return OffsettedElement(offset: input.offset, element: projected) } }.value }