Fix potential Widget is disposed exception
authorPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 4 Apr 2016 15:14:06 +0000 (17:14 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 4 Apr 2016 15:14:06 +0000 (17:14 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmDataViewer.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmViewPart.java

index 57cb798..272d471 100644 (file)
@@ -113,13 +113,16 @@ public abstract class AbstractCdmDataViewer extends Viewer implements IConversat
        /** {@inheritDoc} */
        @Override
        public Control getControl() {
+               if(body.isDisposed()){
+                       return null;
+               }
                for(Control child : body.getChildren()){
                        return child;
                }
 
                return body;
        }
-
+       
        /* (non-Javadoc)
         * @see org.eclipse.jface.viewers.Viewer#setInput(java.lang.Object)
         */
index 15a1841..4367e2b 100644 (file)
@@ -110,7 +110,7 @@ public abstract class AbstractCdmViewPart extends ViewPart implements ISelection
 
         Object element = selection.getFirstElement();
       //avoid widget is disposed exceptions
-        if (getViewer().getControl().isDisposed()){
+        if (getViewer().getControl()==null || getViewer().getControl().isDisposed()){
             return;
         }
         getViewer().setInput(element);