From 79428df611a0d21d4787e75060d0abcb2a89f4e1 Mon Sep 17 00:00:00 2001 From: Greg Watson Date: Wed, 3 Jun 2015 14:09:29 -0400 Subject: [PATCH] Bug 469274 - Fix potential NPE if no connection type combo Change-Id: I8e4a3647cea799d6607e082f32e09532a4b999cd Signed-off-by: Greg Watson --- .../ui/widgets/RemoteConnectionWidget.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteConnectionWidget.java b/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteConnectionWidget.java index ec7e8e77d68..4ef182576e2 100644 --- a/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteConnectionWidget.java +++ b/bundles/org.eclipse.remote.ui/src/org/eclipse/remote/ui/widgets/RemoteConnectionWidget.java @@ -197,7 +197,8 @@ public class RemoteConnectionWidget extends Composite { * list of connection types to select from * @since 2.0 */ - public RemoteConnectionWidget(Composite parent, int style, String title, int flags, List connectionTypes) { + public RemoteConnectionWidget(Composite parent, int style, String title, int flags, + List connectionTypes) { this(parent, style, title, flags, null, connectionTypes); } @@ -218,7 +219,8 @@ public class RemoteConnectionWidget extends Composite { * list of connection types to select from * @since 2.0 */ - public RemoteConnectionWidget(Composite parent, int style, String title, int flags, IRunnableContext context, List connectionTypes) { + public RemoteConnectionWidget(Composite parent, int style, String title, int flags, IRunnableContext context, + List connectionTypes) { super(parent, style); if (connectionTypes != null) { @@ -520,8 +522,7 @@ public class RemoteConnectionWidget extends Composite { /* * Enable 'new' button if new connections are supported */ - fNewConnectionButton - .setEnabled(selectedConnectionType.canAdd()); + fNewConnectionButton.setEnabled(selectedConnectionType.canAdd()); } } finally { fWidgetListener.setEnabled(enabled); @@ -651,14 +652,14 @@ public class RemoteConnectionWidget extends Composite { isRemote = !fLocalButton.getSelection(); } fConnectionCombo.setEnabled(fEnabled && isRemote); - fNewConnectionButton.setEnabled(fEnabled && isRemote - && fDefaultConnectionType.canAdd()); + fNewConnectionButton.setEnabled(fEnabled && isRemote && fDefaultConnectionType.canAdd()); } else { IRemoteConnectionType services = getSelectedConnectionType(); fConnectionCombo.setEnabled(fEnabled && services != null); - fNewConnectionButton.setEnabled(fEnabled && services != null - && services.canAdd()); - fConnectionTypeCombo.setEnabled(fEnabled); + fNewConnectionButton.setEnabled(fEnabled && services != null && services.canAdd()); + if (fConnectionTypeCombo != null) { + fConnectionTypeCombo.setEnabled(fEnabled); + } } } }