From c31bfa24ecbdca3faea5061aebd77df7cd0f9f20 Mon Sep 17 00:00:00 2001 From: John Cortell Date: Thu, 20 Jan 2011 20:00:59 +0000 Subject: [PATCH] Bug 334940: NPE in GdbPlugin.shutdownActiveLaunches() during simple junit tests --- .../src/org/eclipse/cdt/dsf/gdb/internal/GdbPlugin.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPlugin.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPlugin.java index 392823ad39b..fb0247a0fb5 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPlugin.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbPlugin.java @@ -91,7 +91,14 @@ public class GdbPlugin extends Plugin { * is shut down will result in exceptions. */ private void shutdownActiveLaunches() { - for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) { + + DebugPlugin debugPlugin = DebugPlugin.getDefault(); + if (debugPlugin == null) { + // Simple junit tests don't cause the platform debug plugins to load + return; + } + + for (ILaunch launch : debugPlugin.getLaunchManager().getLaunches()) { if (launch instanceof GdbLaunch && ((GdbLaunch)launch).getSession().isActive()) { final GdbLaunch gdbLaunch = (GdbLaunch)launch;