summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/basic/strbuf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/basic/strbuf.c b/src/basic/strbuf.c
index 77220c0251..dac2881603 100644
--- a/src/basic/strbuf.c
+++ b/src/basic/strbuf.c
@@ -156,6 +156,10 @@ ssize_t strbuf_add_string(struct strbuf *str, const char *s, size_t len) {
return off;
}
+ /* bsearch is not allowed on a NULL sequence */
+ if (node->children_count == 0)
+ break;
+
/* lookup child node */
c = s[len - 1 - depth];
search.c = c;