NPE in PluginManager when asking for list on non existing dir

Asking for list of installed plugins with no existing plugin dir:

```sh
$ bin/plugin --list
```

It causes a NPE in PluginManager.
Closes #3253.
This commit is contained in:
David Pilato 2013-06-27 16:12:08 +02:00
parent 2fb5d3ff51
commit f5e5eb5fb9
1 changed files with 5 additions and 5 deletions

View File

@ -297,12 +297,12 @@ public class PluginManager {
public void listInstalledPlugins() {
File[] plugins = environment.pluginsFile().listFiles();
System.out.println("Installed plugins:");
if (plugins.length == 0) {
if (plugins == null || plugins.length == 0) {
System.out.println(" - No plugin detected in " + environment.pluginsFile().getAbsolutePath());
}
for (int i = 0; i < plugins.length; i++) {
System.out.println(" - " + plugins[i].getName());
} else {
for (int i = 0; i < plugins.length; i++) {
System.out.println(" - " + plugins[i].getName());
}
}
}