diff options
author | Andrey Loskutov | 2014-07-31 07:11:26 +0000 |
---|---|---|
committer | Robin Rosenberg | 2014-08-02 01:28:27 +0000 |
commit | 5ac83e036285637dcc7488a9b026707854681000 (patch) | |
tree | 386f3875231f5097ecc87cbe6e739a81ca366c39 | |
parent | 3d9681c1169c6947389b73d5f22b727561a977e3 (diff) | |
download | egit-5ac83e036285637dcc7488a9b026707854681000.tar.gz egit-5ac83e036285637dcc7488a9b026707854681000.tar.xz egit-5ac83e036285637dcc7488a9b026707854681000.zip |
Cleaned up 3 compiler NPE warnings (false positive)
Eclipse compiler issued false positive about access to indexDiff which
might be null. Simplified code to make compiler happy.
Change-Id: I9905a4df4521abccf8126fb5526856ee9f032d4b
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java index 6487377129..6d58de6996 100644 --- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java +++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/staging/StagingView.java @@ -2091,7 +2091,15 @@ public class StagingView extends ViewPart implements IShowInSource { return; final IndexDiffData indexDiff = doReload(repository); - boolean indexDiffAvailable = (indexDiff != null); + boolean indexDiffAvailable; + boolean noConflicts; + if (indexDiff == null) { + indexDiffAvailable = false; + noConflicts = true; + } else { + indexDiffAvailable = true; + noConflicts = indexDiff.getConflicting().isEmpty(); + } if (repositoryChanged) { // Reset paths, they're from the old repository @@ -2124,9 +2132,10 @@ public class StagingView extends ViewPart implements IShowInSource { updateRebaseButtonVisibility(repository.getRepositoryState() .isRebasing()); + boolean commitEnabled = indexDiffAvailable && repository.getRepositoryState().canCommit() - && indexDiff.getConflicting().isEmpty(); + && noConflicts; commitButton.setEnabled(commitEnabled); boolean commitAndPushEnabled = commitEnabled @@ -2135,13 +2144,12 @@ public class StagingView extends ViewPart implements IShowInSource { boolean rebaseContinueEnabled = indexDiffAvailable && repository.getRepositoryState().isRebasing() - && indexDiff.getConflicting().isEmpty(); + && noConflicts; rebaseContinueButton.setEnabled(rebaseContinueEnabled); form.setText(StagingView.getRepositoryName(repository)); updateCommitMessageComponent(repositoryChanged, indexDiffAvailable); - enableCommitWidgets(indexDiffAvailable - && indexDiff.getConflicting().isEmpty()); + enableCommitWidgets(indexDiffAvailable && noConflicts); updateSectionText(); } }); |