Fied console NPE
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / views / PHPConsole.java
index 7bf0f41..a858f5c 100644 (file)
@@ -117,13 +117,14 @@ public class PHPConsole extends ViewPart {
   public static PHPConsole getInstance() {
     IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
     PHPConsole console = (PHPConsole) page.findView(PHPConsole.CONSOLE_ID);
-    if (console == null) {
-      console = (PHPConsole) page.findView(PHPConsole.CONSOLE_ID);
-    }
+
     if (PHPeclipsePlugin.getDefault().getPreferenceStore().getBoolean(PHPeclipsePlugin.SHOW_OUTPUT_IN_CONSOLE) == true) {
 
       try {
         page.showView(PHPConsole.CONSOLE_ID);
+        if (console == null) {
+          console = (PHPConsole) page.findView(PHPConsole.CONSOLE_ID);
+        }
       } catch (PartInitException e) {
         PHPeclipsePlugin.getDefault().getLog().log(
           new Status(