summaryrefslogtreecommitdiff
path: root/t/helper/test-string-list.c
diff options
context:
space:
mode:
Diffstat (limited to 't/helper/test-string-list.c')
-rw-r--r--t/helper/test-string-list.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/helper/test-string-list.c b/t/helper/test-string-list.c
index c502fa16d3..829ec3d7d2 100644
--- a/t/helper/test-string-list.c
+++ b/t/helper/test-string-list.c
@@ -108,7 +108,7 @@ int cmd_main(int argc, const char **argv)
* Split by newline, but don't create a string_list item
* for the empty string after the last separator.
*/
- if (sb.buf[sb.len - 1] == '\n')
+ if (sb.len && sb.buf[sb.len - 1] == '\n')
strbuf_setlen(&sb, sb.len - 1);
string_list_split_in_place(&list, sb.buf, '\n', -1);