Guard for null tree in ts_document_edit
This commit is contained in:
parent
b7b082d9b1
commit
7be067a2e9
1 changed files with 2 additions and 0 deletions
|
|
@ -49,6 +49,8 @@ void ts_document_set_input_string(TSDocument *document, const char *text) {
|
|||
}
|
||||
|
||||
void ts_document_edit(TSDocument *document, TSInputEdit edit) {
|
||||
if (!document->tree) return;
|
||||
|
||||
size_t max_chars = ts_tree_total_size(document->tree).chars;
|
||||
if (edit.position > max_chars)
|
||||
edit.position = max_chars;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue