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).
When
info.getMenuPath().getLeaf()
wasnull
, thecontext()
method was throwing aNullPointerException
. 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 onMenuEntry
.Alternatively, instead of:
name() != "" + info.getMenuPath().getLeaf()
we could also use:name() != Objects.toString(info.getMenuPath().getLeaf())
(see this SO post).Any opinions, @frauzufall ?