From 9155dc50c3f1acd319298e8605ae4a3aeb863f38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Ga=CC=88rtner?= Date: Tue, 8 Sep 2015 15:23:31 +0200 Subject: [PATCH] prevent exceptions with empty and- and or-qualifiers in ERXPrefixQualifierTraversal --- .../ERXPrefixQualifierTraversal.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Frameworks/Core/ERExtensions/Sources/er/extensions/qualifiers/ERXPrefixQualifierTraversal.java b/Frameworks/Core/ERExtensions/Sources/er/extensions/qualifiers/ERXPrefixQualifierTraversal.java index 703735d762f..e892d3a3c44 100644 --- a/Frameworks/Core/ERExtensions/Sources/er/extensions/qualifiers/ERXPrefixQualifierTraversal.java +++ b/Frameworks/Core/ERExtensions/Sources/er/extensions/qualifiers/ERXPrefixQualifierTraversal.java @@ -60,19 +60,27 @@ protected boolean traverseNotQualifier(EONotQualifier q) { @Override protected boolean traverseOrQualifier(EOOrQualifier q) { - NSRange range = new NSRange(_qualifiers.count() - q.qualifiers().count(), q.qualifiers().count()); - ERXOrQualifier oq = new ERXOrQualifier(_qualifiers.subarrayWithRange(range)); - _qualifiers.removeObjectsInRange(range); - _qualifiers.addObject(oq); + if (q.qualifiers().isEmpty()) { + _qualifiers.addObject(new ERXOrQualifier()); + } else { + NSRange range = new NSRange(_qualifiers.count() - q.qualifiers().count(), q.qualifiers().count()); + ERXOrQualifier oq = new ERXOrQualifier(_qualifiers.subarrayWithRange(range)); + _qualifiers.removeObjectsInRange(range); + _qualifiers.addObject(oq); + } return true; } @Override protected boolean traverseAndQualifier(EOAndQualifier q) { - NSRange range = new NSRange(_qualifiers.count() - q.qualifiers().count(), q.qualifiers().count()); - ERXAndQualifier aq = new ERXAndQualifier(_qualifiers.subarrayWithRange(range)); - _qualifiers.removeObjectsInRange(range); - _qualifiers.addObject(aq); + if (q.qualifiers().isEmpty()) { + _qualifiers.addObject(new ERXAndQualifier()); + } else { + NSRange range = new NSRange(_qualifiers.count() - q.qualifiers().count(), q.qualifiers().count()); + ERXAndQualifier aq = new ERXAndQualifier(_qualifiers.subarrayWithRange(range)); + _qualifiers.removeObjectsInRange(range); + _qualifiers.addObject(aq); + } return true; }