From 4a0a5f0a09081d2240d7f37d3bb528d09c48f27a Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Tue, 22 Nov 2011 16:58:44 +0100 Subject: [PATCH] Don't try to parse 0-length data since TM don't support it --- src/document.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/document.c b/src/document.c index cf3fdcc9db..dbc1e39d16 100644 --- a/src/document.c +++ b/src/document.c @@ -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);