spell: fix refresh of bar item "spell_suggest" when the input becomes empty (closes #1586)

When the input is empty, length of string is zero: when sending zero to
function weechat_string_dyn_alloc, the function returns NULL and therefore we
return immediately instead of handling the empty input, which is a valid value.

The regression was introduced by the use of dynamic strings, commit:
299f74bfef9e0d239ad141a4df3b2dcf11a4c0da
This commit is contained in:
Sébastien Helleu 2020-11-13 21:26:16 +01:00
parent 4065d32e68
commit eb90a73fe8
2 changed files with 8 additions and 1 deletions

View File

@ -15,6 +15,13 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
(file _ReleaseNotes.adoc_ in sources).
[[v3.1]]
== Version 3.1 (under dev)
Bug fixes::
* spell: fix refresh of bar item "spell_suggest" when the input becomes empty (issue #1586)
[[v3.0]]
== Version 3.0 (2020-11-11)

View File

@ -801,7 +801,7 @@ spell_modifier_cb (const void *pointer, void *data,
color_error = weechat_color (weechat_config_string (spell_config_color_misspelled));
length = strlen (string);
result = weechat_string_dyn_alloc (length * 2);
result = weechat_string_dyn_alloc ((length * 2) + 1);
if (!result)
return NULL;