Avoid converting target_id if it's None

This commit is contained in:
Rapptz 2023-02-25 06:05:16 -05:00
parent fd9f3e9eff
commit 517d7ae4fe

View File

@ -723,11 +723,12 @@ class AuditLogEntry(Hashable):
if self.action.target_type is None:
return None
if self._target_id is None:
return None
try:
converter = getattr(self, '_convert_target_' + self.action.target_type)
except AttributeError:
if self._target_id is None:
return None
return Object(id=self._target_id)
else:
return converter(self._target_id)