Skip to content

Commit

Permalink
Merge pull request #675 from sgaertner/ERXPrefixQualifierTraversal_patch
Browse files Browse the repository at this point in the history
prevent exceptions with empty and- and or-qualifiers in ERXPrefixQualifierTraversal
  • Loading branch information
darkv committed Sep 8, 2015
2 parents 0e44219 + 9155dc5 commit c12ac94
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit c12ac94

Please sign in to comment.