Fix issue for string_strim if string was empty and not allocated.

This commit is contained in:
Patrick Pelissier committed 2018-08-03 20:23:24 +02:00
1 parent 34d56c54c8
commit 354327e40b
1 file changed
+2 -1
+2 -1
View File
@@ -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;
}