Skip to content

Commit dab1970

Browse files
committed
add a guard
1 parent 8614d52 commit dab1970

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sentry_sdk/traces.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ def _end(self, end_timestamp: "Optional[Union[float, datetime]]" = None) -> None
451451
if self._scope is None:
452452
return
453453

454+
if not hasattr(self._previous_span_on_scope):
455+
return
456+
454457
with capture_internal_exceptions():
455458
old_span = self._previous_span_on_scope
456459
del self._previous_span_on_scope

0 commit comments

Comments
 (0)