From b2459d1222047dd54bcea1801398a1a78954fbe7 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Sun, 6 Nov 2011 18:14:58 +0100 Subject: [PATCH] fix possible NullPointerException --- .../scm/plugin/PluginInformationComparator.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scm-core/src/main/java/sonia/scm/plugin/PluginInformationComparator.java b/scm-core/src/main/java/sonia/scm/plugin/PluginInformationComparator.java index cdb0777cae..fa9fb606b9 100644 --- a/scm-core/src/main/java/sonia/scm/plugin/PluginInformationComparator.java +++ b/scm-core/src/main/java/sonia/scm/plugin/PluginInformationComparator.java @@ -78,8 +78,21 @@ public class PluginInformationComparator if (result == 0) { - result = plugin.getState().getCompareValue() - - other.getState().getCompareValue(); + PluginState state = plugin.getState(); + PluginState otherState = other.getState(); + + if ((state != null) && (otherState != null)) + { + result = state.getCompareValue() - otherState.getCompareValue(); + } + else if ((state == null) && (otherState != null)) + { + result = 1; + } + else if ((state != null) && (otherState == null)) + { + result = -1; + } } }