]> source.dussan.org Git - jgit.git/commitdiff
Avoid NullPointerException in PlotCommit 02/2702/1
authorMathias Kinzler <mathias.kinzler@sap.com>
Mon, 14 Mar 2011 14:40:22 +0000 (15:40 +0100)
committerMathias Kinzler <mathias.kinzler@sap.com>
Mon, 14 Mar 2011 14:40:22 +0000 (15:40 +0100)
Bug: 339289
Change-Id: Idf36f080ae6638c2bdbe11d69a4ad870851622b1
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/revplot/AbstractPlotRenderer.java
org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java

index 10d37ea07a1f5b78445d30eb98bef2afb9b9def1..a641dee545195a17bafef958203f8c19fce59e86 100644 (file)
@@ -148,7 +148,7 @@ public abstract class AbstractPlotRenderer<TLane extends PlotLane, TColor> {
                        drawCommitDot(dotX, dotY, dotSize, dotSize);
 
                int textx = Math.max(maxCenter + LANE_WIDTH / 2, dotX + dotSize) + 8;
-               int n = commit.refs == null ? 0 : commit.refs.length;
+               int n = commit.refs.length;
                for (int i = 0; i < n; ++i) {
                        textx += drawLabel(textx + dotSize, h/2, commit.refs[i]);
                }
index 53020f49d4e892a4dbeff5a69c7db47d77b6f9b9..ea2437ff77671749e48fbba844233c544190a4e7 100644 (file)
@@ -114,14 +114,13 @@ public class PlotWalk extends RevWalk {
 
        private Ref[] getRefs(final AnyObjectId commitId) {
                Collection<Ref> list = reverseRefMap.get(commitId);
-               Ref[] tags;
                if (list == null)
-                       tags = null;
+                       return PlotCommit.NO_REFS;
                else {
-                       tags = list.toArray(new Ref[list.size()]);
+                       Ref[] tags = list.toArray(new Ref[list.size()]);
                        Arrays.sort(tags, new PlotRefComparator());
+                       return tags;
                }
-               return tags;
        }
 
        class PlotRefComparator implements Comparator<Ref> {