Don't try to parse 0-length data since TM don't support it

This commit is contained in:
Colomban Wendling 2011-11-22 16:58:44 +01:00
parent c252b1f376
commit 4a0a5f0a09

View File

@ -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);