Skip to content

Commit 429c838

Browse files
committed
check validity of self before _get_template_line
1 parent db8d74e commit 429c838

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pythonFiles/PythonTools/visualstudio_py_debugger.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -754,13 +754,14 @@ def get_django_frame_source(frame):
754754
except:
755755
pass
756756
if frame.f_code.co_name == 'render':
757-
origin = _get_template_file_name(frame)
758-
line = _get_template_line(frame)
759-
position = None
760757
self_obj = frame.f_locals.get('self', None)
761758
if self_obj is None:
762759
return None
763760

761+
origin = _get_template_file_name(frame)
762+
line = _get_template_line(frame)
763+
position = None
764+
764765
if self_obj is not None and hasattr(self_obj, 'token') and hasattr(self_obj.token, 'position'):
765766
position = self_obj.token.position
766767

0 commit comments

Comments
 (0)