Skip to content

Commit

Permalink
Fix in json_fragment leaf (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
grigory51 authored Nov 26, 2024
1 parent 8382c3c commit 3ed7606
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions annet/annlib/jsontools.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ def _ensure_pointer_exists(doc: Dict[str, Any], pointer: jsonpointer.JsonPointer
parts_except_the_last = pointer.get_parts()[:-1]
doc_pointer: Dict[str, Any] = doc
for part in parts_except_the_last:
if part not in doc_pointer:
# create an empty object by the pointer part
doc_pointer[part] = {}

if isinstance(doc_pointer, dict):
if part not in doc_pointer or doc_pointer[part] is None:
# create an empty object by the pointer part
doc_pointer[part] = {}

# follow the pointer to delve deeper
doc_pointer = doc_pointer[part]
else:
Expand Down

0 comments on commit 3ed7606

Please sign in to comment.