From 354327e40b3e2902b17222d83af216ca40977b44 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Fri, 3 Aug 2018 20:23:24 +0200 Subject: [PATCH] Fix issue for string_strim if string was empty and not allocated. --- m-string.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/m-string.h b/m-string.h index 290f3940..2dc70778 100644 --- a/m-string.h +++ b/m-string.h @@ -782,7 +782,8 @@ string_strim(string_t v, const char charac[]) while (size > 0 && stringi_strim_char(b[size-1], charac)) size --; if (size == 0) { - v->ptr[0] = 0; + if (v->ptr != NULL) + v->ptr[0] = 0; v->size = size; return; }