From: James Moger Date: Fri, 18 Apr 2014 02:45:20 +0000 (-0400) Subject: [findbugs] Add null check when closing a RevWalk in JGitUtils X-Git-Tag: v1.5.0~14 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=87170e14d1260c722c5e534c2e405764153d5946;p=gitblit.git [findbugs] Add null check when closing a RevWalk in JGitUtils --- diff --git a/src/main/java/com/gitblit/utils/JGitUtils.java b/src/main/java/com/gitblit/utils/JGitUtils.java index 0cee70d5..190872a7 100644 --- a/src/main/java/com/gitblit/utils/JGitUtils.java +++ b/src/main/java/com/gitblit/utils/JGitUtils.java @@ -2256,8 +2256,10 @@ public class JGitUtils { } } catch (IOException e) { LOGGER.error("Failed to determine canMerge", e); - } finally { - revWalk.release(); + } finally { + if (revWalk != null) { + revWalk.release(); + } } return MergeStatus.NOT_MERGEABLE; } @@ -2347,8 +2349,10 @@ public class JGitUtils { } } catch (IOException e) { LOGGER.error("Failed to merge", e); - } finally { - revWalk.release(); + } finally { + if (revWalk != null) { + revWalk.release(); + } } return new MergeResult(MergeStatus.FAILED, null); }