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

Fix: #163. IndexError when matching values. #164

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/pyld/jsonld.py
Original file line number Diff line number Diff line change
Expand Up @@ -4504,7 +4504,7 @@ def _value_match(self, pattern, value):

if not v2 and not t2 and not l2:
return True
if not (v1 in v2 or _is_empty_object(v2[0])):
if not (v1 in v2 or not v2 or _is_empty_object(v2[0])):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be:

Suggested change
if not (v1 in v2 or not v2 or _is_empty_object(v2[0])):
if not (v1 in v2 or (v2 and _is_empty_object(v2[0]))):

Ideally tests would confirm.

return False
if not ((not t1 and not t2) or (t1 in t2) or (t1 and t2 and _is_empty_object(t2[0]))):
return False
Expand Down