Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Piers2019-03-27 09:35:08 -0400
committerLaurent Goubet2019-04-01 10:29:32 -0400
commit494572716c1daa07a97817e2e77bdef92df38ad7 (patch)
tree7de6f231d9929504091c15ef9c1af7b6d37fd179
parent28a35cf425a6cc97cd851303fe24266e1b3f04ae (diff)
downloadorg.eclipse.emf.compare-494572716c1daa07a97817e2e77bdef92df38ad7.tar.gz
org.eclipse.emf.compare-494572716c1daa07a97817e2e77bdef92df38ad7.tar.xz
org.eclipse.emf.compare-494572716c1daa07a97817e2e77bdef92df38ad7.zip
Fixed ArrayOutOfBounds in case of empty lists3.3.7M2
Change-Id: I02d226989219d523f660abeffc73007f5cc33b94 Signed-off-by: William Piers <william.piers@obeo.fr>
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/PropertyDescriptorItem.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/PropertyDescriptorItem.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/PropertyDescriptorItem.java
index fe913a1d9..d66cf7479 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/PropertyDescriptorItem.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/property/PropertyDescriptorItem.java
@@ -146,11 +146,16 @@ class PropertyDescriptorItem extends PropertyItem {
int insertionIndex = DiffUtil.findInsertionIndex(comparison, diff,
getSide() == MergeViewerSide.LEFT);
- // Correct the index based on how many placeholders are already
- // earlier in the list of children.
- List<PropertyItem> subList = propertyItems.subList(0, insertionIndex);
- final int count = size(filter(subList, IMergeViewerItem.IS_INSERTION_POINT));
- int index = Math.min(insertionIndex + count, propertyItems.size());
+ int index;
+ if (propertyItems.size() > 0) {
+ // Correct the index based on how many placeholders are already
+ // earlier in the list of children.
+ List<PropertyItem> subList = propertyItems.subList(0, insertionIndex);
+ final int count = size(filter(subList, IMergeViewerItem.IS_INSERTION_POINT));
+ index = Math.min(insertionIndex + count, propertyItems.size());
+ } else {
+ index = 0;
+ }
// Create the placeholder and insert it at the appropriate
// place in the list.

Back to the top