aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Baumgart2010-08-10 09:48:13 (EDT)
committerJens Baumgart2010-08-10 09:48:13 (EDT)
commitcee1a9902d0e41c1854270f787c2f5fc2fba697d (patch)
treee2e5e1325dff5a227db503a46db77a8214b9a15e
parent06982d718f858e7de35b4e030b7ad0ee2f91bc1e (diff)
downloadegit-cee1a9902d0e41c1854270f787c2f5fc2fba697d.zip
egit-cee1a9902d0e41c1854270f787c2f5fc2fba697d.tar.gz
egit-cee1a9902d0e41c1854270f787c2f5fc2fba697d.tar.bz2
Fix NPE in History Viewrefs/changes/75/1275/1
Bug: 322231 Change-Id: I7fda6a3517c97b5e0131f6bd90da4966eff68f86 Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java3
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java11
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties2
3 files changed, 15 insertions, 1 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
index 7392944..513fcf5 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIText.java
@@ -2240,6 +2240,9 @@ public class UIText extends NLS {
public static String CommitAction_messagepart6;
/** */
+ public static String CommitFileDiffViewer_notContainedInCommit;
+
+ /** */
public static String GitSynchronizeWizard_synchronize;
/** */
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java
index 6116c20..211ef9e 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/CommitFileDiffViewer.java
@@ -32,6 +32,7 @@ import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.treewalk.TreeWalk;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.DND;
@@ -103,7 +104,15 @@ class CommitFileDiffViewer extends TableViewer {
IWorkbenchPage page = window.getActivePage();
IFileRevision rev = CompareUtils.getFileRevision(d.path, d.commit,
db, d.blobs[0]);
- EgitUiEditorUtils.openEditor(page, rev, new NullProgressMonitor());
+ if (rev != null)
+ EgitUiEditorUtils.openEditor(page, rev,
+ new NullProgressMonitor());
+ else {
+ String message = NLS.bind(
+ UIText.CommitFileDiffViewer_notContainedInCommit, d.path,
+ d.commit.getId().getName());
+ Activator.showError(message, null);
+ }
} catch (IOException e) {
Activator.logError(UIText.GitHistoryPage_openFailed, e);
Activator.showError(UIText.GitHistoryPage_openFailed, null);
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
index 800e8eb..044e873 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/uitext.properties
@@ -791,6 +791,8 @@ CommitAction_messagepart4=and try again.
CommitAction_messagepart5=Please enter the commit message for your changes. Lines starting
CommitAction_messagepart6=with '\#' will be ignored, and an empty message aborts the commit.
+CommitFileDiffViewer_notContainedInCommit=File {0} is not contained in commit {1}
+
GitSynchronizeWizard_synchronize=Synchronize
GitSynchronizeWizard_gitResourceSynchronization=Git Resource Synchronization