Author: jflesch
Date: 2006-10-28 15:10:34 +0000 (Sat, 28 Oct 2006)
New Revision: 10723

Modified:
   trunk/apps/Thaw/src/thaw/core/PluginManager.java
Log:
Fix NPE

Modified: trunk/apps/Thaw/src/thaw/core/PluginManager.java
===================================================================
--- trunk/apps/Thaw/src/thaw/core/PluginManager.java    2006-10-28 14:51:20 UTC 
(rev 10722)
+++ trunk/apps/Thaw/src/thaw/core/PluginManager.java    2006-10-28 15:10:34 UTC 
(rev 10723)
@@ -94,12 +94,17 @@
                        Plugin plugin = (Plugin)pluginIt.next();

                        try {
-                               Logger.info(this, "Running plugin 
'"+plugin.getClass().getName()+"'");
+                               if (plugin != null) {
+                                       Logger.info(this, "Running plugin 
'"+plugin.getClass().getName()+"'");
+                                       
+                                       
this.core.getSplashScreen().setProgressionAndStatus(this.core.getSplashScreen().getProgression()+progressJump,
+                                                                               
            "Starting plugin '"+plugin.getClass().getName()+"' ...");
+                                       plugin.run(this.core);

-                               
this.core.getSplashScreen().setProgressionAndStatus(this.core.getSplashScreen().getProgression()+progressJump,
-                                                                               
    "Starting plugin '"+plugin.getClass().getName()+"' ...");
+                               }
+                               else
+                                       Logger.notice(this, "Plugin == null ?");

-                               plugin.run(this.core);
                        } catch(Exception e) {
                                Logger.error(this, "Unable to run the plugin 
'"+plugin.getClass().getName()+"' because: "+e+":");
                                e.printStackTrace();
@@ -128,7 +133,10 @@
                        Plugin plugin = (Plugin)pluginIt.next();

                        try {
-                               plugin.stop();
+                               if (plugin != null)
+                                       plugin.stop();
+                               else
+                                       Logger.notice(this, "Plugin == null 
?!!");
                        } catch(Exception e) {
                                Logger.error(this, "Unable to stop the plugin "+
                                             
"'"+plugin.getClass().getName()+"'"+
@@ -210,7 +218,7 @@
                                return false;
                        }

-                       this.plugins.put(className, null);
+                       this.plugins.remove(className);

                } catch(Exception e) {
                        Logger.warning(this, "unloadPlugin('"+className+"'): 
Exception: "+e);


Reply via email to