diff options
author | Aearil <45526730+aearil@users.noreply.github.com> | 2019-04-29 14:24:29 +0000 |
---|---|---|
committer | fiaxh <fiaxh@users.noreply.github.com> | 2019-04-29 08:24:29 -0600 |
commit | f4778ef3e66bda41831251c486e497075cb82d66 (patch) | |
tree | a513072185031bdb436265542f587fda5ba92370 /main | |
parent | 97c59cb8cda49335ce464dd1bb1c508bc6cc7e2a (diff) | |
download | dino-f4778ef3e66bda41831251c486e497075cb82d66.tar.gz dino-f4778ef3e66bda41831251c486e497075cb82d66.zip |
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.
Diffstat (limited to 'main')
-rw-r--r-- | main/src/ui/chat_input/view.vala | 8 |
1 files changed, 6 insertions, 2 deletions
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]); |