summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2015-08-24 11:05:31 +0200
committerSébastien Helleu <flashcode@flashtux.org>2015-08-24 11:05:31 +0200
commit41cb1bf635eb56b7189dbfbdb89432dca1f46ede (patch)
tree7741fd1b405d0ce934433033d2cfdfa06af534cc /src/core
parentc8ac75601f0c0003c7ec0bf6605bd6e2258ab5a3 (diff)
downloadweechat-41cb1bf635eb56b7189dbfbdb89432dca1f46ede.zip
api: fix handle of invalid escape in function string_convert_escaped_chars()
And a new test is now checking that "\" returns "".
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-string.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/wee-string.c b/src/core/wee-string.c
index 389d12c62..9ae23d7f3 100644
--- a/src/core/wee-string.c
+++ b/src/core/wee-string.c
@@ -787,9 +787,12 @@ string_convert_escaped_chars (const char *string)
}
break;
default:
- output[pos_output++] = '\\';
- output[pos_output++] = ptr_string[0];
- ptr_string++;
+ if (ptr_string[0])
+ {
+ output[pos_output++] = '\\';
+ output[pos_output++] = ptr_string[0];
+ ptr_string++;
+ }
break;
}
}