scijava / scijava-search

Search framework for SciJava applications :mag:
BSD 2-Clause "Simplified" License
2 stars 2 forks source link

ModuleSearchResult: be more defensive when checking menu leaf #7

Closed imagejan closed 6 years ago

imagejan commented 6 years ago

When info.getMenuPath().getLeaf() was null, the context() method was throwing a NullPointerException. This is the case for e.g. net.imagej.updater.PromptUserToUpdate - just search for the label There are updates available.

Let's be more defensive and avoid calling the toString() method on MenuEntry.

Alternatively, instead of: name() != "" + info.getMenuPath().getLeaf() we could also use: name() != Objects.toString(info.getMenuPath().getLeaf()) (see this SO post).

Any opinions, @frauzufall ?

frauzufall commented 6 years ago

Good find! Looks fine.