Fixes NPE when no term was selected but the edit button was pressed
authorn.hoffmann <n.hoffmann@localhost>
Wed, 25 May 2011 13:32:46 +0000 (13:32 +0000)
committern.hoffmann <n.hoffmann@localhost>
Wed, 25 May 2011 13:32:46 +0000 (13:32 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/AbstractMenuPreferences.java

index 05beaa4347de2bdecbbe5f71c346cde72bd749b8..bd9df2e8e60733c57f93b653b5d2b80c41dd33ed 100644 (file)
@@ -235,6 +235,11 @@ public abstract class AbstractMenuPreferences<T extends DefinedTermBase> extends
                        public void widgetSelected(SelectionEvent e) {
                                T selection = (T) ((StructuredSelection) tableViewer.getSelection()).getFirstElement();
                                
                        public void widgetSelected(SelectionEvent e) {
                                T selection = (T) ((StructuredSelection) tableViewer.getSelection()).getFirstElement();
                                
+                               if(selection == null){
+                                       StoreUtil.informationDialog("Nothing selected", "Please select a term to edit.");
+                                       return;
+                               }
+                               
                                VocabularyTermWizard<T> wizard = new VocabularyTermWizard<T>(getTermClass(), selection, getConversationHolder()); 
                                
                                WizardDialog dialog = new WizardDialog(StoreUtil.getShell(), wizard);
                                VocabularyTermWizard<T> wizard = new VocabularyTermWizard<T>(getTermClass(), selection, getConversationHolder()); 
                                
                                WizardDialog dialog = new WizardDialog(StoreUtil.getShell(), wizard);