From: Patrick Plitzner Date: Mon, 29 May 2017 11:29:48 +0000 (+0200) Subject: Fix possile NPE X-Git-Tag: 4.8.0^2~67^2~15 X-Git-Url: https://dev.e-taxonomy.eu/gitweb/taxeditor.git/commitdiff_plain/b9eddd74b8f658eb31486526b9e2ec308f9b39ac Fix possile NPE --- diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java index f1ffe8abe..03429575a 100644 --- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java +++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java @@ -115,7 +115,7 @@ public abstract class AbstractUtility { * @return true on success */ public static boolean close(EditorPart editor) { - return getActivePage().closeEditor(editor, true); + return getActivePage() != null ? getActivePage().closeEditor(editor, true):false; } /** @@ -139,9 +139,12 @@ public abstract class AbstractUtility { * @return a {@link org.eclipse.ui.IWorkbenchPage} object. */ public static IWorkbenchPage getActivePage() { - - return TaxeditorStorePlugin.getDefault().getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); + try{ + return TaxeditorStorePlugin.getDefault().getWorkbench() + .getActiveWorkbenchWindow().getActivePage(); + } catch(NullPointerException npe){ + return null; + } } /**