# HG changeset patch # User dadubrow # Date 1278009068 18000 # Node ID ad3475a0684e41e787d21a6f25117cb1bda252ba # Parent 1c3ed56966df409da7b4ed1df840ae99714f9e13 fix potential npe diff -r 1c3ed56966df -r ad3475a0684e debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/SerialConnectionFactory.java --- a/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/SerialConnectionFactory.java Wed Jun 30 15:34:24 2010 -0500 +++ b/debuggercdi/com.nokia.carbide.trk.support/src/com/nokia/carbide/trk/support/connection/SerialConnectionFactory.java Thu Jul 01 13:31:08 2010 -0500 @@ -18,19 +18,26 @@ package com.nokia.carbide.trk.support.connection; -import com.freescale.cdt.debug.cw.core.SerialConnectionSettings; -import com.nokia.carbide.remoteconnections.interfaces.*; -import com.nokia.carbide.trk.support.Messages; +import java.util.HashMap; +import java.util.Map; -import org.eclipse.jface.viewers.*; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; -import java.util.HashMap; -import java.util.Map; +import com.freescale.cdt.debug.cw.core.SerialConnectionSettings; +import com.nokia.carbide.remoteconnections.interfaces.IConnection; +import com.nokia.carbide.remoteconnections.interfaces.IConnectionFactory; +import com.nokia.carbide.remoteconnections.interfaces.IConnectionType; +import com.nokia.carbide.trk.support.Messages; /** * Implementation of IConnectionFactory for serial connections @@ -122,7 +129,8 @@ for (String key : map.keySet()) { ComboViewer viewer = viewers.get(key); if (viewer != null) { - viewer.setSelection(new StructuredSelection(settings.getSettings().get(key))); + String element = map.get(key); + viewer.setSelection(element != null ? new StructuredSelection(element) : StructuredSelection.EMPTY); } } }