Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2015-05-26 09:00:36 +0000
committerLaurent Delaigue2015-05-27 09:09:14 +0000
commitee8a3eeb1c0881002546a443bc3f22524529a7ac (patch)
treec503f4a6650b0b5df3bccd63b2e0c4859bf2cdab /plugins
parentdb9f81ea7ff7f799e51218520c9d250efb715834 (diff)
downloadorg.eclipse.emf.compare-ee8a3eeb1c0881002546a443bc3f22524529a7ac.tar.gz
org.eclipse.emf.compare-ee8a3eeb1c0881002546a443bc3f22524529a7ac.tar.xz
org.eclipse.emf.compare-ee8a3eeb1c0881002546a443bc3f22524529a7ac.zip
[468267] Fix NPE in EMFCompareDiffTreeRuler#findFirstAncestorTreeItem.
Bug: 468267 Change-Id: I40d001a63459925135b5de07ccfab219edd4ef4f Signed-off-by: Axel Richard <axel.richard@obeo.fr>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeRuler.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeRuler.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeRuler.java
index e767b7af8..1472615eb 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeRuler.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeRuler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 Obeo.
+ * Copyright (c) 2013, 2015 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -220,13 +220,26 @@ public class EMFCompareDiffTreeRuler extends Canvas {
private TreeItem findFirstAncestorTreeItem(TreeNode node) {
CompareInputAdapter cia = findFirstAncestorCompareInputAdapter(node);
- Object item = fTreeViewer.testFindItem(cia);
+ Object item;
+ if (cia != null) {
+ item = fTreeViewer.testFindItem(cia);
+ } else {
+ item = null;
+ }
TreeNode parent = node;
while (!(item instanceof TreeItem) && (parent = parent.getParent()) != null) {
cia = findFirstAncestorCompareInputAdapter(parent);
- item = fTreeViewer.testFindItem(cia);
+ if (cia != null) {
+ item = fTreeViewer.testFindItem(cia);
+ } else {
+ item = null;
+ }
+ }
+ if (item instanceof TreeItem) {
+ return (TreeItem)item;
+ } else {
+ return null;
}
- return (TreeItem)item;
}
private CompareInputAdapter findFirstAncestorCompareInputAdapter(TreeNode node) {

Back to the top