Fix potential NPE #5565
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 23 Feb 2016 16:55:35 +0000 (17:55 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 23 Feb 2016 16:55:35 +0000 (17:55 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/description/operation/ChangeDescriptionElementType.java

index df7a426c6627e591f788ffd0c439138354f5ffa5..6b8dd63bf73e72e06447708925556dcdb7fff44f 100644 (file)
@@ -14,6 +14,9 @@ import org.eclipse.core.commands.operations.IUndoContext;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
 
 import eu.etaxonomy.cdm.model.description.CategoricalData;
 import eu.etaxonomy.cdm.model.description.CommonTaxonName;
@@ -91,7 +94,10 @@ public class ChangeDescriptionElementType extends AbstractPostTaxonOperation {
                                destinationElement = TextData.NewInstance();
                        }
                }
-               
+               if(destinationElement==null){
+                       MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Change not possible", "Feature does not have another type");
+                       return Status.CANCEL_STATUS;
+               }
                destinationElement.setFeature(feature);
                inDescription.addElement(destinationElement);
                inDescription.removeElement(sourceElement);