diff --git a/aws_xray_sdk/ext/django/templates.py b/aws_xray_sdk/ext/django/templates.py index 4052db76..1eaa7736 100644 --- a/aws_xray_sdk/ext/django/templates.py +++ b/aws_xray_sdk/ext/django/templates.py @@ -23,7 +23,8 @@ def xray_render(self, context): if template_name: name = str(template_name) subsegment = xray_recorder.current_subsegment() - subsegment.name = name + if subsegment: + subsegment.name = name return Template._xray_original_render(self, context)