Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent exceptions with empty and- and or-qualifiers in ERXPrefixQualifierTraversal #675

Merged

Conversation

sgaertner
Copy link
Contributor

In Wonder it is legal to create empty ERXAndQualifier and ERXOrQualifiers. This is convenient when creating complex qualifiers dynamically, which depend on user input and whether certain sub-qualifiers shall be included or not.

However when trying to prefix a qualifier structure, which contains empty ERXAndQualifier and ERXOrQualifiers, an exception is thrown due to an invalid NSRange. Sample code (both lines generate an exception):

  System.out.println(new ERXKey("prefix").dot(ERXQ.and()));
  System.out.println(new ERXKey("prefix").dot(ERXQ.and(ERXQ.equals("foo", "bar"), ERXQ.or())));

This patch solves the issue in ERXPrefixQualifierTraversal.

darkv added a commit that referenced this pull request Sep 8, 2015
prevent exceptions with empty and- and or-qualifiers in ERXPrefixQualifierTraversal
@darkv darkv merged commit c12ac94 into wocommunity:master Sep 8, 2015
@sgaertner sgaertner deleted the ERXPrefixQualifierTraversal_patch branch September 8, 2015 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants