From 1073983301328065efb8f1a757d9a25631144616 Mon Sep 17 00:00:00 2001 From: Minke Zhang Date: Mon, 15 Nov 2021 03:29:39 -0800 Subject: [PATCH] Fix rangesearch attempting to dereference nil pointers --- internal/rangesearch/rangesearch.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/rangesearch/rangesearch.go b/internal/rangesearch/rangesearch.go index 264e3a3..be38d4d 100644 --- a/internal/rangesearch/rangesearch.go +++ b/internal/rangesearch/rangesearch.go @@ -13,6 +13,10 @@ import ( // Search traverses the K-D tree node and returns all child nodes which are // contained in the bounding rectangle. func Search(n *node.N, r hyperrectangle.R) []*node.N { + if n == nil { + return nil + } + min := make([]float64, n.P().Dimension()) max := make([]float64, n.P().Dimension())