From 7a24088d0d4316e113387d229ed0491e31226348 Mon Sep 17 00:00:00 2001
From: bkonkle
Date: Fri, 9 Sep 2011 10:22:19 -0700
Subject: If a stacktrace frame is not in the expected format, skip over it
---
debug_toolbar/panels/sql.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
(limited to 'debug_toolbar')
diff --git a/debug_toolbar/panels/sql.py b/debug_toolbar/panels/sql.py
index 841aaac..9687a5c 100644
--- a/debug_toolbar/panels/sql.py
+++ b/debug_toolbar/panels/sql.py
@@ -190,11 +190,15 @@ class SQLDebugPanel(DebugPanel):
query['start_offset'] = width_ratio_tally
query['end_offset'] = query['width_ratio'] + query['start_offset']
width_ratio_tally += query['width_ratio']
-
+
stacktrace = []
for frame in query['stacktrace']:
params = map(escape, frame[0].rsplit('/', 1) + list(frame[1:]))
- stacktrace.append(u'{0}/{1} in {3}({2})\n {4}'.format(*params))
+ try:
+ stacktrace.append(u'{0}/{1} in {3}({2})\n {4}'.format(*params))
+ except IndexError:
+ # This frame doesn't have the expected format, so skip it and move on to the next one
+ continue
query['stacktrace'] = mark_safe('\n'.join(stacktrace))
i += 1
--
cgit v1.2.3