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); diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c index 3117e345..4eaab712 100644 --- a/src/irc/core/irc-servers.c +++ b/src/irc/core/irc-servers.c @@ -116,11 +116,14 @@ static char **split_line(const SERVER_REC *server, const char *line, * the code much simpler. It's worth it. */ len -= strlen(recoded_start) + strlen(recoded_end); + g_warn_if_fail(len > 0); if (len <= 0) { /* There is no room for anything. */ g_free(recoded_start); g_free(recoded_end); - return NULL; + lines = g_new(char *, 1); + lines[0] = NULL; + return lines; } lines = recode_split(server, line, target, len, onspace);