From addf7559021147623fa21c3d894b453f6f22c594 Mon Sep 17 00:00:00 2001 From: nils_2 Date: Fri, 15 Aug 2014 20:56:52 +0200 Subject: [PATCH] aspell: fix crash with command "/aspell addword" if no word is given (closes #164) (cherry picked from commit 2629fd8c74f366fc61ebb953bfe03c744321860d) --- src/plugins/aspell/weechat-aspell-command.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/aspell/weechat-aspell-command.c b/src/plugins/aspell/weechat-aspell-command.c index ccc5dc3c6..41d9e461e 100644 --- a/src/plugins/aspell/weechat-aspell-command.c +++ b/src/plugins/aspell/weechat-aspell-command.c @@ -441,9 +441,13 @@ weechat_aspell_command_cb (void *data, struct t_gui_buffer *buffer, /* add word to personal dictionary */ if (weechat_strcasecmp (argv[1], "addword") == 0) { + if (argc <= 2) + return WEECHAT_RC_ERROR; if (argc > 3) + /* use a given dict */ weechat_aspell_command_add_word (buffer, argv[2], argv_eol[3]); - else + else if (argc > 2) + /* use default dict */ weechat_aspell_command_add_word (buffer, NULL, argv_eol[2]); return WEECHAT_RC_OK; }