Skip to content

Commit

Permalink
Don't try to parse 0-length data since TM don't support it
Browse files Browse the repository at this point in the history
  • Loading branch information
b4n committed Nov 22, 2011
1 parent c252b1f commit 4a0a5f0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/document.c
Expand Up @@ -2260,9 +2260,18 @@ void document_update_tags(GeanyDocument *doc)
return;
}

len = sci_get_length(doc->editor->sci);
/* tm_source_file_buffer_update() below don't support 0-length data,
* so just empty the tags array and leave */
if (len < 1)
{
tm_tags_array_free(doc->tm_file->tags_array, FALSE);
sidebar_update_tag_list(doc, FALSE);
return;
}

/* Parse Scintilla's buffer directly using TagManager
* Note: this buffer *MUST NOT* be modified */
len = sci_get_length(doc->editor->sci);
buffer_ptr = (guchar *) scintilla_send_message(doc->editor->sci, SCI_GETCHARACTERPOINTER, 0, 0);
tm_source_file_buffer_update(doc->tm_file, buffer_ptr, len, TRUE);

Expand Down

0 comments on commit 4a0a5f0

Please sign in to comment.