facontidavide / Bonxai

Fast, hierarchical, sparse Voxel Grid
Mozilla Public License 2.0
659 stars 56 forks source link

Bug causes by value() before setValue() #3

Closed getupgetup closed 2 years ago

getupgetup commented 2 years ago

Thanks for your great work. I'm using your VoxelGrid to replace my own grid so that performance can be improved. However, I got a problem. Here's my pseudo code: / pesudor code auto ptr = accessor.value(coord); if(ptr){ DoSomething(); } else{ accessor.setValue(coord, new_value); } / If ptr is nullptr(coord has not been setValue before), error happens! "prev_leafptr = getLeafGrid(coord, false)" in value() makes prev_leafptr nullptr, then "prev_leafptr->mask.setOn(index)" in setValue() caused segmentfault. Is there anything I'm missing? Thank you.

facontidavide commented 2 years ago

Thanks for reporting, I will have a look at it

facontidavide commented 2 years ago

thanks again