From 16b3fbcfd655c5efce75b24714402beae7c0465e Mon Sep 17 00:00:00 2001 From: Alvaro Sanchez-Leon Date: Mon, 21 Mar 2016 14:03:39 -0400 Subject: [PATCH] GDB Automatic remote launch, NP Exception check Null pointer checks were missing in GdbLaunch e.g. to cover the case when the instance is not fully initialized e.g. invalid gdbserver path. Change-Id: Ie5b593417aa831cb5b35b19f31d2b0a03b1fdc86 Signed-off-by: Alvaro Sanchez-Leon --- .../cdt/dsf/gdb/launching/GdbLaunch.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java index 7d677614840..f7b21796c3c 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/launching/GdbLaunch.java @@ -364,8 +364,11 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr new IStatus[] { getStatus() }, "Session shutdown failed", null)); //$NON-NLS-1$ } // Last order of business, shutdown the dispatch queue. - fTracker.dispose(); - fTracker = null; + if (fTracker != null) { + fTracker.dispose(); + fTracker = null; + } + DsfSession.endSession(fSession); // 'fireTerminate()' removes this launch from the list @@ -390,12 +393,16 @@ public class GdbLaunch extends DsfLaunch implements ITerminate, IDisconnect, ITr final Step[] steps = new Step[] { new Step() { @Override public void execute(RequestMonitor rm) { - IGDBControl control = fTracker.getService(IGDBControl.class); - if (control == null) { - rm.done(); - return; + if (fTracker != null) { + IGDBControl control = fTracker.getService(IGDBControl.class); + if (control != null) { + control.terminate(rm); + return; + } } - control.terminate(rm); + + rm.done(); + return; } },