From f4778ef3e66bda41831251c486e497075cb82d66 Mon Sep 17 00:00:00 2001 From: Aearil <45526730+aearil@users.noreply.github.com> Date: Mon, 29 Apr 2019 14:24:29 +0000 Subject: Fix when /affiliate cmd doesn't get enough args (#557) Added array bounds checking to /affiliate command parsing. Maybe some user feedback when using the different commands would be useful. --- main/src/ui/chat_input/view.vala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'main/src/ui') diff --git a/main/src/ui/chat_input/view.vala b/main/src/ui/chat_input/view.vala index a33e8b53..ddf1b3c0 100644 --- a/main/src/ui/chat_input/view.vala +++ b/main/src/ui/chat_input/view.vala @@ -112,8 +112,12 @@ public class View : Box { stream_interactor.get_module(MucManager.IDENTITY).kick(conversation.account, conversation.counterpart, token[1]); return; case "/affiliate": - string[] user_role = token[1].split(" ", 2); - stream_interactor.get_module(MucManager.IDENTITY).change_affiliation(conversation.account, conversation.counterpart, user_role[0].strip(), user_role[1].strip()); + if (token.length > 1) { + string[] user_role = token[1].split(" ", 2); + if (user_role.length == 2) { + stream_interactor.get_module(MucManager.IDENTITY).change_affiliation(conversation.account, conversation.counterpart, user_role[0].strip(), user_role[1].strip()); + } + } return; case "/nick": stream_interactor.get_module(MucManager.IDENTITY).change_nick(conversation.account, conversation.counterpart, token[1]); -- cgit v1.2.3-70-g09d2