From 977400b544786c7d6e2830d3fe3d37c718ffedb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 5 Jun 2018 17:37:49 +0200 Subject: [PATCH] fix: index out of range in add_object --- pymisp/api.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pymisp/api.py b/pymisp/api.py index 8a543eb..42eb9e4 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -1895,11 +1895,12 @@ class PyMISP(object): # NOTE: this slightly fucked up thing is due to the fact template_id was required, and was the 2nd parameter. template_id = kwargs.get('template_id') misp_object = kwargs.get('misp_object') - if isinstance(args[0], MISPObject): - misp_object = args[0] - else: - template_id = args[0] - misp_object = args[1] + if args: + if isinstance(args[0], MISPObject): + misp_object = args[0] + else: + template_id = args[0] + misp_object = args[1] if template_id is not None: url = urljoin(self.root_url, 'objects/add/{}/{}'.format(event_id, template_id))