changeset 95:6fb474ebe666

Only select an item if there is an item in list
author Omair Majid <omajid@redhat.com>
date Thu, 06 Feb 2014 13:50:10 -0500
parents 146a0704ba68
children 10ffc183f39e
files com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/BaseMasterDetailsBlock.java
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/BaseMasterDetailsBlock.java	Thu Feb 06 10:37:06 2014 -0500
+++ b/com.redhat.thermostat.tools.eclipse.plugin/src/com/redhat/thermostat/tools/eclipse/plugin/editor/BaseMasterDetailsBlock.java	Thu Feb 06 13:50:10 2014 -0500
@@ -91,7 +91,9 @@
                 addButtonSelected(parent.getShell());
 
                 Object lastElement = viewer.getElementAt(viewer.getTable().getItemCount() - 1);
-                viewer.setSelection(new StructuredSelection(lastElement));
+                if (lastElement != null) {
+                    viewer.setSelection(new StructuredSelection(lastElement));
+                }
             }
 
         });