ome / omero-insight

Gradle project containing insight java client for OMERO
https://www.openmicroscopy.org/omero/
GNU General Public License v2.0
7 stars 14 forks source link

Logical AND needed #414

Closed scuniff closed 11 months ago

scuniff commented 11 months ago

https://github.com/ome/omero-insight/blob/21b72187f896c36e356dfa6c4c3116bc4b633ba2/src/main/java/org/openmicroscopy/shoola/agents/treeviewer/browser/BrowserControl.java#L328

Regarding the if statement:

                List<?> l = display.getChildrenDisplay();
                if (l != null & l.size() > 0) {
                    view.expandNode((TreeImageDisplay) l.get(0), true);
                }

If variable l is null then there will be a NPE when l.size() is executed

I think logical AND && is needed

                List<?> l = display.getChildrenDisplay();
                if (l != null && l.size() > 0) {
                    view.expandNode((TreeImageDisplay) l.get(0), true);
                }
jburel commented 11 months ago

Fixed in #419