aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Baumgart2010-08-10 10:46:26 (EDT)
committerJens Baumgart2010-08-10 10:46:26 (EDT)
commit1c6f83130edb969deffaa40ab3fdd769f361296e (patch)
tree809f1734744b7e88e0f2a89b080c6a75ac90f9b2
parent06982d718f858e7de35b4e030b7ad0ee2f91bc1e (diff)
downloadegit-1c6f83130edb969deffaa40ab3fdd769f361296e.zip
egit-1c6f83130edb969deffaa40ab3fdd769f361296e.tar.gz
egit-1c6f83130edb969deffaa40ab3fdd769f361296e.tar.bz2
Fix DiscardChangesActionrefs/changes/78/1278/1
Fix ArrayIndexOutOfBoundsException in DiscardChangesAction. Bug: 321846 Change-Id: I3d469664d593ff5773272760c2f5594af44ba96f Signed-off-by: Jens Baumgart <jens.baumgart@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/DiscardChangesActionHandler.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/DiscardChangesActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/DiscardChangesActionHandler.java
index b5caf5e..e62c669 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/DiscardChangesActionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/DiscardChangesActionHandler.java
@@ -62,7 +62,10 @@ public class DiscardChangesActionHandler extends RepositoryActionHandler {
try {
for (IResource res : getSelectedResources(null)) {
IProject[] proj = new IProject[] { res.getProject() };
- Repository repository = getRepositoriesFor(proj)[0];
+ Repository[] repositories = getRepositoriesFor(proj);
+ if (repositories.length == 0)
+ return false;
+ Repository repository = repositories[0];
if (!repository.getRepositoryState().equals(
RepositoryState.SAFE)) {
return false;