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
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 @@
 		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) {