Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimeon Andreev2018-06-01 09:55:46 -0400
committerSimeon Andreev2018-06-01 10:27:12 -0400
commite6af2c77b1a2e9ebdad8c1036600a84618de2c6f (patch)
tree184e3ad8eb498fc237ba1dc183e9ec2d716b5354
parent45add9a8becea83d0bf35fd5990cb4b6fdb7f348 (diff)
downloadeclipse.platform.debug-e6af2c77b1a2e9ebdad8c1036600a84618de2c6f.tar.gz
eclipse.platform.debug-e6af2c77b1a2e9ebdad8c1036600a84618de2c6f.tar.xz
eclipse.platform.debug-e6af2c77b1a2e9ebdad8c1036600a84618de2c6f.zip
Bug 535454 - do not allow null context in DebugContextEvent constructor
In case of a null context passed to the constructor of DebugContextEvent, a NPE could be thrown later on when the event is being processed. This is the case since DebugContextEvent.getContext() makes no mention of possibly returning a null. E.g. some code in ToggleStepFiltersAction and LaunchView does not check if the returned context is null. At the point of throwing the NPE, its unclear where the null context actually came from. For issues which are difficult to reproduce, this information is vital. With this change, an exception is thrown if the passed context is null. Change-Id: If7a86500bc827bc6aa73ca971c9be79a714be81f Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/DebugContextEvent.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/DebugContextEvent.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/DebugContextEvent.java
index a8e116f05..47668a56a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/DebugContextEvent.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/DebugContextEvent.java
@@ -12,6 +12,7 @@ package org.eclipse.debug.ui.contexts;
import java.util.EventObject;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ISelection;
/**
@@ -64,6 +65,7 @@ public class DebugContextEvent extends EventObject {
*/
public DebugContextEvent(IDebugContextProvider source, ISelection context, int flags) {
super(source);
+ Assert.isNotNull(context, "DebugContextEvent context must not be null"); //$NON-NLS-1$
fContext = context;
fFlags = flags;
}

Back to the top