From dac076c24232e6d657b6f5201a709626de8114e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sat, 16 Aug 2014 09:07:10 +0200 Subject: aspell: display an error if command "/aspell setdict" is called without a dictionary --- src/plugins/aspell/weechat-aspell-command.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3