Skip to content

Commit

Permalink
fix(tree): return None if node is null
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime committed May 15, 2024
1 parent 7ce5af7 commit 54f923a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tree_sitter/binding/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ PyObject *tree_root_node_with_offset(Tree *self, PyObject *args) {

ModuleState *state = GET_MODULE_STATE(self);
TSNode node = ts_tree_root_node_with_offset(self->tree, offset_bytes, offset_extent);
if (ts_node_is_null(node)) {
Py_RETURN_NONE;
}
return node_new_internal(state, node, (PyObject *)self);
}

Expand Down

0 comments on commit 54f923a

Please sign in to comment.