diff options
author | Stefan Lay | 2010-09-13 14:56:47 +0000 |
---|---|---|
committer | Stefan Lay | 2010-09-13 14:56:47 +0000 |
commit | 3357d4e2ba49e1b6a43991a251c1fcb157aa632e (patch) | |
tree | 929689b842bc381fd4328340ffa21398d53bdf51 | |
parent | 06d14b39fa580600b4faf4b21b7cf4322f24d7de (diff) | |
download | egit-3357d4e2ba49e1b6a43991a251c1fcb157aa632e.tar.gz egit-3357d4e2ba49e1b6a43991a251c1fcb157aa632e.tar.xz egit-3357d4e2ba49e1b6a43991a251c1fcb157aa632e.zip |
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: Iccea8f6053a461a5e2562bdf4edcf03ad45b4ae3
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
-rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/GitHistoryPage.java | 8 |
1 files changed, 3 insertions, 5 deletions
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<String> paths = new ArrayList<String>(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); |