summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorian Zschocke <florian.zschocke@devolo.de>2019-11-07 23:35:06 +0100
committerFlorian Zschocke <florian.zschocke@devolo.de>2019-11-07 23:45:59 +0100
commit909d1fd211c1e60c044c1bca81dc4d6a0a622802 (patch)
tree4b9ed033915d7dddc519e349e55d6986122e83d3 /src
parentb902e6949ea283e9e553b5b9288bb1da13193db7 (diff)
downloadgitblit-909d1fd211c1e60c044c1bca81dc4d6a0a622802.tar.gz
gitblit-909d1fd211c1e60c044c1bca81dc4d6a0a622802.zip
Fix NullpointerException when stopping GitBlit Server.
When GitBlit server did not start properly, is running but couldn't start the `PluginManager`, then stopping the server via the `--stop` argument on the command line resulted in a NullpointerException. Which left the server running. Now this is prevented and the server will actually shut down.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/gitblit/servlet/GitblitContext.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/com/gitblit/servlet/GitblitContext.java b/src/main/java/com/gitblit/servlet/GitblitContext.java
index 750da796..cd8615a8 100644
--- a/src/main/java/com/gitblit/servlet/GitblitContext.java
+++ b/src/main/java/com/gitblit/servlet/GitblitContext.java
@@ -293,11 +293,13 @@ public class GitblitContext extends GuiceServletContextListener {
logger.info("Gitblit context destroyed by servlet container.");
IPluginManager pluginManager = getManager(IPluginManager.class);
- for (LifeCycleListener listener : pluginManager.getExtensions(LifeCycleListener.class)) {
- try {
- listener.onShutdown();
- } catch (Throwable t) {
- logger.error(null, t);
+ if (pluginManager != null) {
+ for (LifeCycleListener listener : pluginManager.getExtensions(LifeCycleListener.class)) {
+ try {
+ listener.onShutdown();
+ } catch (Throwable t) {
+ logger.error(null, t);
+ }
}
}