mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +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.jface.viewers.ITreeSelection;
|
||||||
import org.eclipse.linuxtools.docker.core.IDockerConnection;
|
import org.eclipse.linuxtools.docker.core.IDockerConnection;
|
||||||
import org.eclipse.ui.ISelectionListener;
|
import org.eclipse.ui.ISelectionListener;
|
||||||
|
import org.eclipse.ui.IWorkbench;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
|
import org.eclipse.ui.IWorkbenchWindow;
|
||||||
|
|
||||||
public class ConnectionListener implements ISelectionListener {
|
public class ConnectionListener implements ISelectionListener {
|
||||||
|
|
||||||
|
@ -23,11 +25,16 @@ public class ConnectionListener implements ISelectionListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
DockerLaunchUIPlugin.getDefault().getWorkbench()
|
IWorkbench workbench = DockerLaunchUIPlugin.getDefault().getWorkbench();
|
||||||
.getActiveWorkbenchWindow().getSelectionService()
|
if (workbench != null) {
|
||||||
|
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
|
||||||
|
if (window != null) {
|
||||||
|
window.getSelectionService()
|
||||||
.addSelectionListener(
|
.addSelectionListener(
|
||||||
"org.eclipse.linuxtools.docker.ui.dockerExplorerView", //$NON-NLS-1$
|
"org.eclipse.linuxtools.docker.ui.dockerExplorerView", //$NON-NLS-1$
|
||||||
this);
|
this);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDockerConnection getCurrentConnection() {
|
public IDockerConnection getCurrentConnection() {
|
||||||
|
|
|
@ -85,8 +85,11 @@ public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIpAddress() {
|
public String getIpAddress() {
|
||||||
IDockerNetworkSettings networkSettings = info.networkSettings();
|
if (info != null) {
|
||||||
return networkSettings.ipAddress();
|
IDockerNetworkSettings networkSettings = info.networkSettings();
|
||||||
|
return networkSettings.ipAddress();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDockerContainerInfo getContainerInfo() {
|
public IDockerContainerInfo getContainerInfo() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue