On Jan 2, 2013, at 3:18 PM, Kuu wrote:
> Focusing in the possible bug, in the SparseGrid2D class, in the function reduceObjectsAtLocations() (line 620), there is a call to the method getObjectsAtLocation() in the line 636, which may return a null value, the code is:
> Bag temp = getObjectsAtLocation(xs[i],ys[i]); //line 636 this can return 'null'
> int size = temp.numObjs; //line 637
> And as you can see, if the value of "temp" is null, the line 637 will throw a null pointer exception as it's happening to me.
Hi Javier, I think you are correct. The correct code should include a null check:
// for each location...
for(int i=0; i < len; i++)
Bag temp = getObjectsAtLocation(xs[i],ys[i]);
if (temp != null)
final int size = temp.numObjs;
final Object os = temp.objs;
// for each object at that location...
for(int j = 0; j < size; j++)
// add the result, the x, and the y
There are similar errors in SparseGrid3D and the two Continuous classes.