1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

Fix potential NPEs

Change-Id: I1648e8bda4de9129ae15432e73b070d64b8c3e17
Signed-off-by: Greg Watson <g.watson@computer.org>
This commit is contained in:
Greg Watson 2015-03-16 16:02:22 -04:00
parent 45072181ad
commit da73772cb7
2 changed files with 3 additions and 2 deletions

View file

@ -264,7 +264,7 @@ public class RemoteResourceBrowser extends Dialog implements IRunnableContext {
* connection that supports the IRemoteFileService service * connection that supports the IRemoteFileService service
*/ */
public void setConnection(IRemoteConnection connection) { public void setConnection(IRemoteConnection connection) {
if (connection.hasService(IRemoteFileService.class)) { if (connection != null && connection.hasService(IRemoteFileService.class)) {
fConnection = connection; fConnection = connection;
} }
} }

View file

@ -220,6 +220,8 @@ public class RemoteResourceBrowserWidget extends Composite {
fRemoteConnectionWidget = new RemoteConnectionWidget(mainComp, SWT.NONE, "", //$NON-NLS-1$ fRemoteConnectionWidget = new RemoteConnectionWidget(mainComp, SWT.NONE, "", //$NON-NLS-1$
(fOptionFlags & SHOW_LOCAL_SELECTION) == 0 ? RemoteConnectionWidget.FLAG_NO_LOCAL_SELECTION : 0); (fOptionFlags & SHOW_LOCAL_SELECTION) == 0 ? RemoteConnectionWidget.FLAG_NO_LOCAL_SELECTION : 0);
fRemoteConnectionWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); fRemoteConnectionWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
// Must happen before adding selection listener as this will trigger selection event
fRemoteConnectionWidget.filterConnections(IRemoteFileService.class);
fRemoteConnectionWidget.addSelectionListener(new SelectionAdapter() { fRemoteConnectionWidget.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
@ -237,7 +239,6 @@ public class RemoteResourceBrowserWidget extends Composite {
})); }));
} }
}); });
fRemoteConnectionWidget.filterConnections(IRemoteFileService.class);
} }
Composite textComp = new Composite(mainComp, SWT.NONE); Composite textComp = new Composite(mainComp, SWT.NONE);