From fe960cb825c9188dd726630c6c79c0003ba3a629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Fri, 4 Sep 2020 09:29:19 +0200 Subject: plugins/code: Prevent traceback when not enough arguments -- thanks Ge0rG MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- plugins/code.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/code.py b/plugins/code.py index 1c6dfab0..8d9c57a3 100644 --- a/plugins/code.py +++ b/plugins/code.py @@ -41,7 +41,11 @@ class Plugin(BasePlugin): help='Sends syntax-highlighted code in the current tab') def command_code(self, args): - language, code = args.split(None, 1) + split = args.split(None, 1) + if len(split) != 2: + self.api.information('Usage: /code ', 'Error') + return None + language, code = split lexer = get_lexer_by_name(language) tab = self.api.current_tab() code = highlight(code, lexer, FORMATTER) -- cgit v1.2.3