fiji / SNT

Legacy project superseded by https://github.com/morphonets/SNT
GNU General Public License v3.0
11 stars 29 forks source link

NPE from MouseLightLoader #62

Closed kephale closed 4 years ago

kephale commented 4 years ago

from code:

...
            SWCPoint soma = (SWCPoint) loader.getNodes("soma").toArray()[0];
            AllenCompartment thisSomaCompartment = (AllenCompartment) soma.getAnnotation();

            if (thisSomaCompartment.contains(somaCompartment)) {
...

I'm getting (after a bunch are successfully downloaded):

...
Parsing AA0952...
Exception in thread "main" java.lang.NullPointerException
    at sc.iview.neurongrammars.FetchNeurons.main(FetchNeurons.java:77)
tferr commented 4 years ago

@kephale, is this still an issue? It is possible for a node to have no annotations: E.g., the Allen CCF is not annotated in the cerebellum (and some anterior regions of the olfactory bulb) (I think that is the case for that cell id). A way to avoid that is to check for null, or make that code null proof:

AllenCompartment thisSomaCompartment = (AllenCompartment) soma.getAnnotation();
if (myCompartmentOfInterst.equals(thisSomaCompartment) || myCompartmentOfInterst.contains(thisSomaCompartment);
kephale commented 4 years ago

Yeah, I just did a null check to avoid this.