From a35fb8c652acbfd41292d1c97b5998dd26a0dfce Mon Sep 17 00:00:00 2001 From: Stefan Lay Date: Mon, 13 Sep 2010 13:17:28 +0200 Subject: Fix NullPointer in HistoryView With 7f6821cfd3b577bbb82f12e54f36cd8e6d1904da a NullPointer was introduced. This is fixed with this commit. Now currentWalk is not set to null per default and it is only released if necessary. Because cancelRefreshJob() may set currentWalk to null it has to be newly created in case it is null. Bug: 324943 Bug: 325081 Change-Id: I0d6c032e35576ded39d4bced1ff5dfde613cc932 Signed-off-by: Stefan Lay --- .../src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'org.eclipse.egit.ui') diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java index addca61eeb..52d0c5a321 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java @@ -1009,10 +1009,6 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener { return false; db = null; - if (currentWalk != null) { - currentWalk.release(); - currentWalk = null; - } final ArrayList paths = new ArrayList(in.length); for (final IResource r : in) { @@ -1054,7 +1050,7 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener { return false; } - if (pathChange(pathFilters, paths) + if (pathChange(pathFilters, paths) || currentWalk == null || headId != null && !headId.equals(currentHeadId)) { // TODO Do not dispose SWTWalk just because HEAD changed // In theory we should be able to update the graph and @@ -1062,6 +1058,8 @@ public class GitHistoryPage extends HistoryPage implements RefsChangedListener { // HEAD^1 and the old HEAD commit should not be visible. // currentHeadId = headId; + if (currentWalk != null) + currentWalk.release(); currentWalk = new SWTWalk(db); currentWalk.sort(RevSort.COMMIT_TIME_DESC, true); currentWalk.sort(RevSort.BOUNDARY, true); -- cgit v1.2.3