summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2014-08-16 09:07:10 +0200
committerSébastien Helleu <flashcode@flashtux.org>2014-08-16 09:07:10 +0200
commitdac076c24232e6d657b6f5201a709626de8114e3 (patch)
treed4889ddf9e00e27a9d70c0a6ef6d3d6b4dea1c0e /src
parent2d5f563d890b32690e77b0059d4522d5a431af78 (diff)
downloadweechat-dac076c24232e6d657b6f5201a709626de8114e3.zip
aspell: display an error if command "/aspell setdict" is called without a dictionary
Diffstat (limited to 'src')
-rw-r--r--src/plugins/aspell/weechat-aspell-command.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/plugins/aspell/weechat-aspell-command.c b/src/plugins/aspell/weechat-aspell-command.c
index 28a50589e..0f06dfcd4 100644
--- a/src/plugins/aspell/weechat-aspell-command.c
+++ b/src/plugins/aspell/weechat-aspell-command.c
@@ -420,14 +420,13 @@ weechat_aspell_command_cb (void *data, struct t_gui_buffer *buffer,
/* set dictionary for current buffer */
if (weechat_strcasecmp (argv[1], "setdict") == 0)
{
- if (argc > 2)
- {
- dicts = weechat_string_replace (argv_eol[2], " ", "");
- weechat_aspell_command_set_dict (buffer,
- (dicts) ? dicts : argv[2]);
- if (dicts)
- free (dicts);
- }
+ if (argc < 3)
+ return WEECHAT_RC_ERROR;
+ dicts = weechat_string_replace (argv_eol[2], " ", "");
+ weechat_aspell_command_set_dict (buffer,
+ (dicts) ? dicts : argv[2]);
+ if (dicts)
+ free (dicts);
return WEECHAT_RC_OK;
}