aboutsummaryrefslogtreecommitdiff
path: root/src/HtmlSearch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/HtmlSearch.c')
-rw-r--r--src/HtmlSearch.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/HtmlSearch.c b/src/HtmlSearch.c
index bc58881..d72055a 100644
--- a/src/HtmlSearch.c
+++ b/src/HtmlSearch.c
@@ -43,7 +43,10 @@ static int string_ensure_capacity(QuickMediaString *self, size_t new_capacity) {
}
static int string_append(QuickMediaString *self, const char *str, size_t size) {
- int res = string_ensure_capacity(self, self->size + size);
+ if(size == 0)
+ return 0;
+
+ int res = string_ensure_capacity(self, self->size + size + 1);
if(res != 0)
return res;
@@ -445,7 +448,7 @@ static int merge_inner_text(QuickMediaHtmlNode *node, QuickMediaString *str) {
const char *inner_text = node->name.data;
size_t inner_text_size = node->name.size;
strip(inner_text, inner_text_size, &inner_text, &inner_text_size, is_newline);
- if(inner_text_size > 0) {
+ if(inner_text_size > 0) { /* ignore empty text, but add the original text */
if(string_append(str, node->name.data, node->name.size) != 0)
return 1;
}