Skip to content

Commit

Permalink
Warning instead of panic for geom outside grid
Browse files Browse the repository at this point in the history
  • Loading branch information
kad-dirc committed Apr 8, 2024
1 parent aaa3bb6 commit f2795b0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pointindex/pointindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package pointindex
import (
"fmt"
"io"
"log"
"math"
"slices"

Expand Down Expand Up @@ -135,7 +136,7 @@ func (ix *PointIndex) InsertCoord(deepestX int, deepestY int) {
deepestSize := int(mathhelp.Pow2(ix.maxDepth))
if deepestX < 0 || deepestY < 0 || deepestX > deepestSize-1 || deepestY > deepestSize-1 {
// should never happen
panic(fmt.Errorf("trying to insert a coord (%v, %v) outside the grid/extent (0, %v; 0, %v)", deepestX, deepestY, deepestSize, deepestSize))
log.Println(fmt.Errorf("[WARNING] Trying to insert a coord (%v, %v) outside the grid/extent (0, %v; 0, %v)", deepestX, deepestY, deepestSize, deepestSize))
}
ix.insertCoord(deepestX, deepestY)
}
Expand Down

0 comments on commit f2795b0

Please sign in to comment.