Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Furnadjiev2017-01-31 05:21:48 -0500
committerIvan Furnadjiev2017-01-31 05:21:48 -0500
commit2c7794db39e20a0c5f442a0b76eb8db52d450636 (patch)
tree765def043d669980e44b72e58159ce64483ce0ec
parentbcaf29172e6798678affcf3d265ec77e8aebdf84 (diff)
downloadorg.eclipse.rap.incubator.e4-2c7794db39e20a0c5f442a0b76eb8db52d450636.tar.gz
org.eclipse.rap.incubator.e4-2c7794db39e20a0c5f442a0b76eb8db52d450636.tar.xz
org.eclipse.rap.incubator.e4-2c7794db39e20a0c5f442a0b76eb8db52d450636.zip
Fix NPE in HandlerServiceImpl if provided context is already disposed
HandlerServiceImpl#getContextStack may return null if the provided context is already disposed. Return empty stack list in this case. 510621: [e4] NullPointerException in HandlerServiceImpl.executeHandler() https://bugs.eclipse.org/bugs/show_bug.cgi?id=510621 Change-Id: If56c1d567a36090359d6dc2a3f4c7f7fd2074695
-rw-r--r--bundles/org.eclipse.e4.core.commands/src-rap/org/eclipse/e4/core/commands/internal/HandlerServiceImpl.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/bundles/org.eclipse.e4.core.commands/src-rap/org/eclipse/e4/core/commands/internal/HandlerServiceImpl.java b/bundles/org.eclipse.e4.core.commands/src-rap/org/eclipse/e4/core/commands/internal/HandlerServiceImpl.java
index f763a1e..ad283fc 100644
--- a/bundles/org.eclipse.e4.core.commands/src-rap/org/eclipse/e4/core/commands/internal/HandlerServiceImpl.java
+++ b/bundles/org.eclipse.e4.core.commands/src-rap/org/eclipse/e4/core/commands/internal/HandlerServiceImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2013 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -78,7 +78,11 @@ public class HandlerServiceImpl implements EHandlerService {
if (context == null) {
return DEFAULT_STACKLIST;
}
- return (LinkedList<ExecutionContexts>) context.get("_handlerExecutionStack"); //$NON-NLS-1$
+ Object handlerExecutionStack = context.get("_handlerExecutionStack"); //$NON-NLS-1$
+ if (handlerExecutionStack == null) {
+ return DEFAULT_STACKLIST;
+ }
+ return (LinkedList<ExecutionContexts>) handlerExecutionStack;
}
public static void push(IEclipseContext ctx, IEclipseContext staticCtx) {

Back to the top