fix: object_uuid could be None

Fix #640
pull/660/head
Raphaël Vinot 2020-11-10 12:04:14 +01:00
parent b646f0c5da
commit 3b130bd973
1 changed files with 5 additions and 1 deletions

View File

@ -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: