Skip to content

Commit e33c137

Browse files
mx990fedejeanne
authored andcommitted
Fix NPE when Find action is unavailable in Expressions view
The Find action may be unavailable when the focus is outside the Expressions view, which leads to an NPE in fillContextMenu. This adds a null and enablement check for the Find action to resolve the problem.
1 parent 81910d7 commit e33c137

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

  • debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/expression/ExpressionView.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,10 @@ protected void fillContextMenu(IMenuManager menu) {
8484
IAction action;
8585
if (DebugPlugin.getDefault().getExpressionManager().getExpressions().length > 0) {
8686
action = getAction(FIND_ACTION);
87-
action.setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_FIND_ACTION));
88-
menu.add(action);
87+
if (action != null && action.isEnabled()) {
88+
action.setImageDescriptor(DebugPluginImages.getImageDescriptor(IDebugUIConstants.IMG_FIND_ACTION));
89+
menu.add(action);
90+
}
8991
}
9092
ChangeVariableValueAction changeValueAction = (ChangeVariableValueAction)getAction("ChangeVariableValue"); //$NON-NLS-1$
9193
if (changeValueAction.isApplicable()) {

0 commit comments

Comments
 (0)