diff options
author | Joseph Bisch <joseph.bisch@gmail.com> | 2017-10-18 14:52:04 -0400 |
---|---|---|
committer | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2017-10-20 15:22:32 +0200 |
commit | 0840eaec7bf56740029aae614e393f8cf76f6946 (patch) | |
tree | cc0764382ec7a11799c5151ee37bcfdea0b6c354 /src/core | |
parent | beb2beba3b4802c6969a5595197e25e7a5483fa3 (diff) | |
download | irssi-0840eaec7bf56740029aae614e393f8cf76f6946.zip |
Make split functions return an array with NULL instead of NULL
This avoids undefined behavior in functions that call these split
functions and expect an array back instead of just a NULL pointer.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/recode.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/recode.c b/src/core/recode.c index d001a46a..d3fc91e7 100644 --- a/src/core/recode.c +++ b/src/core/recode.c @@ -198,7 +198,12 @@ char **recode_split(const SERVER_REC *server, const char *str, int n = 0; char **ret; - g_return_val_if_fail(str != NULL, NULL); + g_warn_if_fail(str != NULL); + if (str == NULL) { + ret = g_new(char *, 1); + ret[0] = NULL; + return ret; + } if (settings_get_bool("recode")) { to = find_conversion(server, target); |