Fix NPE and default connection selector case RCL_2_4
authorEd Swartz <ed.swartz@nokia.com>
Fri, 23 Apr 2010 13:56:44 -0500
branchRCL_2_4
changeset 1273 dcb72c9e2126
parent 1271 6a0e8b610695
child 1276 7f978d9fb8f6
child 1277 12fd76372d95
Fix NPE and default connection selector case
connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ClientServiceSiteUI2.java
--- a/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ClientServiceSiteUI2.java	Fri Apr 23 13:43:04 2010 -0500
+++ b/connectivity/com.nokia.carbide.remoteConnections/src/com/nokia/carbide/remoteconnections/internal/ui/ClientServiceSiteUI2.java	Fri Apr 23 13:56:44 2010 -0500
@@ -95,7 +95,7 @@
 			public void selectionChanged(SelectionChangedEvent event) {
 				IStructuredSelection selection = (IStructuredSelection) event.getSelection();
 				String connection = (String) selection.getFirstElement();
-				if (!connection.equals(ClientServiceSiteUI2.this.connection)) {
+				if (connection != null && !connection.equals(ClientServiceSiteUI2.this.connection)) {
 					ClientServiceSiteUI2.this.connection = connection;
 					fireConnectionSelected();
 				}
@@ -225,7 +225,8 @@
 			if (connection == null) {
 				String lastConnectionId = Registry.instance().getLastConnectionId();
 				if (lastConnectionId != null) {
-					selectConnection(lastConnectionId);
+					viewer.getCombo().select(0);  // the default setting
+					selectConnection(lastConnectionId);  // should override if connection still exists
 				} else {
 					viewer.getCombo().select(0);
 					viewer.setSelection(viewer.getSelection());