mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 09:16:02 +02:00
Bug 469529 - null pointer exception starting Docker launcher
- an init() call from the Docker Launch plugin start() method may not be able to get a Workbench Window so add code to ensure that an NPE does not occur in ConnectionListener - fix the ContainerLaunchConfigurationDelegate to return null for the ipaddress() of the gdbserver run job if the info has not yet been set (thread timing) Change-Id: I6dae9f1997d8b5b7db3246c0feb7966c4795b05b
This commit is contained in:
parent
ae86cacb2d
commit
bd7fad5f67
2 changed files with 14 additions and 4 deletions
|
@ -5,7 +5,9 @@ import org.eclipse.jface.viewers.ISelection;
|
|||
import org.eclipse.jface.viewers.ITreeSelection;
|
||||
import org.eclipse.linuxtools.docker.core.IDockerConnection;
|
||||
import org.eclipse.ui.ISelectionListener;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.IWorkbenchWindow;
|
||||
|
||||
public class ConnectionListener implements ISelectionListener {
|
||||
|
||||
|
@ -23,11 +25,16 @@ public class ConnectionListener implements ISelectionListener {
|
|||
}
|
||||
|
||||
public void init() {
|
||||
DockerLaunchUIPlugin.getDefault().getWorkbench()
|
||||
.getActiveWorkbenchWindow().getSelectionService()
|
||||
IWorkbench workbench = DockerLaunchUIPlugin.getDefault().getWorkbench();
|
||||
if (workbench != null) {
|
||||
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
|
||||
if (window != null) {
|
||||
window.getSelectionService()
|
||||
.addSelectionListener(
|
||||
"org.eclipse.linuxtools.docker.ui.dockerExplorerView", //$NON-NLS-1$
|
||||
this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public IDockerConnection getCurrentConnection() {
|
||||
|
|
|
@ -85,8 +85,11 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
|
|||
}
|
||||
|
||||
public String getIpAddress() {
|
||||
IDockerNetworkSettings networkSettings = info.networkSettings();
|
||||
return networkSettings.ipAddress();
|
||||
if (info != null) {
|
||||
IDockerNetworkSettings networkSettings = info.networkSettings();
|
||||
return networkSettings.ipAddress();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public IDockerContainerInfo getContainerInfo() {
|
||||
|
|
Loading…
Add table
Reference in a new issue