From d3655338ef74d1d0b98e29884457cd33cff6146c Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 25 Feb 2023 06:05:16 -0500 Subject: [PATCH] Avoid converting target_id if it's None --- discord/audit_logs.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/discord/audit_logs.py b/discord/audit_logs.py index 36fcb5704..28b5e3f2b 100644 --- a/discord/audit_logs.py +++ b/discord/audit_logs.py @@ -661,11 +661,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)