# HG changeset patch # User Sascha Wilde # Date 1395671668 -3600 # Node ID 3fb6ddd6b70db2dc59b6932bb67b689c013f867b # Parent 5f830969e4a15ff37665732fe58ab62c6d6f5ab3 str_trim: do nothing if *s is NULL. diff -r 5f830969e4a1 -r 3fb6ddd6b70d common/strhelp.c --- a/common/strhelp.c Mon Mar 24 15:17:16 2014 +0100 +++ b/common/strhelp.c Mon Mar 24 15:34:28 2014 +0100 @@ -129,9 +129,12 @@ str_trim (char **s) { size_t i; - while (isspace(**s)) - (*s)++; - i = strlen(*s); - while (isspace((*s)[--i])) - (*s)[i] = '\0'; + if (*s != NULL) + { + while (isspace(**s)) + (*s)++; + i = strlen(*s); + while (isspace((*s)[--i])) + (*s)[i] = '\0'; + } }