Avoid NullPointerException in PlotCommit

Bug: 339289
Change-Id: Idf36f080ae6638c2bdbe11d69a4ad870851622b1
Signed-off-by: Mathias Kinzler <mathias.kinzler@sap.com>
This commit is contained in:
Mathias Kinzler 2011-03-14 15:40:22 +01:00
parent bd970007be
commit 9b941d0172
2 changed files with 4 additions and 5 deletions

View File

@ -148,7 +148,7 @@ protected void paintCommit(final PlotCommit<TLane> commit, final int h) {
drawCommitDot(dotX, dotY, dotSize, dotSize); drawCommitDot(dotX, dotY, dotSize, dotSize);
int textx = Math.max(maxCenter + LANE_WIDTH / 2, dotX + dotSize) + 8; 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) { for (int i = 0; i < n; ++i) {
textx += drawLabel(textx + dotSize, h/2, commit.refs[i]); textx += drawLabel(textx + dotSize, h/2, commit.refs[i]);
} }

View File

@ -114,14 +114,13 @@ public RevCommit next() throws MissingObjectException,
private Ref[] getRefs(final AnyObjectId commitId) { private Ref[] getRefs(final AnyObjectId commitId) {
Collection<Ref> list = reverseRefMap.get(commitId); Collection<Ref> list = reverseRefMap.get(commitId);
Ref[] tags;
if (list == null) if (list == null)
tags = null; return PlotCommit.NO_REFS;
else { else {
tags = list.toArray(new Ref[list.size()]); Ref[] tags = list.toArray(new Ref[list.size()]);
Arrays.sort(tags, new PlotRefComparator()); Arrays.sort(tags, new PlotRefComparator());
return tags;
} }
return tags;
} }
class PlotRefComparator implements Comparator<Ref> { class PlotRefComparator implements Comparator<Ref> {