Skip to content

Commit

Permalink
Fix NPE in legacyActionLabelSupport
Browse files Browse the repository at this point in the history
If command is null a NPE occurs even though from the code it seems this
should be handled by a fallback.

This replaces Optional.of with Optional.ofNullable to account for that
case.
  • Loading branch information
laeubi committed Jun 18, 2024
1 parent c93e6c3 commit 954bc58
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ private String getToolTipText(boolean attachKeybinding) {

private String legacyActionLabelSupport(String text, ParameterizedCommand command) {

return java.util.Optional.of(command).map(ParameterizedCommand::getCommand).map(Command::getHandler)
return java.util.Optional.ofNullable(command).map(ParameterizedCommand::getCommand).map(Command::getHandler)
.map(IHandler::getHandlerLabel).filter(Objects::nonNull).orElse(text);
}

Expand Down

0 comments on commit 954bc58

Please sign in to comment.