Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2015-05-12 05:29:12 -0400
committerAndrey Loskutov2015-05-24 02:55:01 -0400
commite123410b4fd67ab66a938818a3be66cdf5b584e9 (patch)
tree8244e7f929eedb4f430d642314b66f52afe3226f
parentb377f23ace617a27ebad460eebb6ff9247c31b3f (diff)
downloadegit-e123410b4fd67ab66a938818a3be66cdf5b584e9.tar.gz
egit-e123410b4fd67ab66a938818a3be66cdf5b584e9.tar.xz
egit-e123410b4fd67ab66a938818a3be66cdf5b584e9.zip
Fix NPE in SwitchToMenu.createDynamicMenu
Bug: 466973 Change-Id: I56cb08d15a4c21fa4be9a4c11649ce13ba40ca01 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SwitchToMenu.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SwitchToMenu.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SwitchToMenu.java
index c2f4df0c3..acf51c487 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SwitchToMenu.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/SwitchToMenu.java
@@ -9,6 +9,7 @@
package org.eclipse.egit.ui.internal.actions;
import java.io.IOException;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -27,6 +28,7 @@ import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.ReflogEntry;
+import org.eclipse.jgit.lib.ReflogReader;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -114,8 +116,14 @@ public class SwitchToMenu extends ContributionItem implements
CommonUtils.STRING_ASCENDING_COMPARATOR);
// Add the MAX_NUM_MENU_ENTRIES most recently used branches first
- List<ReflogEntry> reflogEntries = repository.getReflogReader(
- Constants.HEAD).getReverseEntries();
+ ReflogReader reflogReader = repository.getReflogReader(
+ Constants.HEAD);
+ List<ReflogEntry> reflogEntries;
+ if (reflogReader == null) {
+ reflogEntries = Collections.emptyList();
+ } else {
+ reflogEntries = reflogReader.getReverseEntries();
+ }
for (ReflogEntry entry : reflogEntries) {
CheckoutEntry checkout = entry.parseCheckout();
if (checkout != null) {

Back to the top