]> source.dussan.org Git - gitblit.git/commitdiff
[findbugs] Add null check when closing a RevWalk in JGitUtils
authorJames Moger <james.moger@gitblit.com>
Fri, 18 Apr 2014 02:45:20 +0000 (22:45 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 18 Apr 2014 03:08:07 +0000 (23:08 -0400)
src/main/java/com/gitblit/utils/JGitUtils.java

index 0cee70d5d4307fb54c628efb1251f5f9fc7ccbc1..190872a786942052f8dcc618309cb18cec6c2e7f 100644 (file)
@@ -2256,8 +2256,10 @@ public class JGitUtils {
                        }
                } catch (IOException e) {
                        LOGGER.error("Failed to determine canMerge", e);
-               } finally {
-                       revWalk.release();
+               } finally {\r
+                       if (revWalk != null) {
+                               revWalk.release();\r
+                       }
                }
                return MergeStatus.NOT_MERGEABLE;
        }
@@ -2347,8 +2349,10 @@ public class JGitUtils {
                        }
                } catch (IOException e) {
                        LOGGER.error("Failed to merge", e);
-               } finally {
-                       revWalk.release();
+               } finally {\r
+                       if (revWalk != null) {
+                               revWalk.release();\r
+                       }
                }
                return new MergeResult(MergeStatus.FAILED, null);
        }