From 3b130bd9733f64e7684b9d93a898a4fcb647e17f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Tue, 10 Nov 2020 12:04:14 +0100 Subject: [PATCH] fix: object_uuid could be None Fix #640 --- pymisp/mispevent.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pymisp/mispevent.py b/pymisp/mispevent.py index f429691..38860f5 100644 --- a/pymisp/mispevent.py +++ b/pymisp/mispevent.py @@ -832,7 +832,11 @@ class MISPObject(AbstractMISP): if isinstance(referenced_uuid, AbstractMISP): # Allow to pass an object or an attribute instead of its UUID referenced_uuid = referenced_uuid.uuid - if kwargs.get('object_uuid'): + if 'object_uuid' in kwargs and not kwargs.get('object_uuid'): + # Unexplained None in object_uuid key -> https://github.com/MISP/PyMISP/issues/640 + kwargs.pop('object_uuid') + object_uuid = self.uuid + elif kwargs.get('object_uuid'): # Load existing object object_uuid = kwargs.pop('object_uuid') else: