fix(gui): Correct indentation bug in _render_mma_dashboard that caused crash
The code after the 'prior session' return block was incorrectly indented at 1 space, placing it inside the 'if is_viewing_prior_session' block instead of after it. This caused 'total_cost' and 'perc' to be undefined when viewing an active session, triggering an IM_ASSERT error. Fix: Moved 'track_name', 'track_stats', and 'total_cost' to the correct 2-space indentation (method body level).
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
import tokenize
|
||||
|
||||
import io
|
||||
|
||||
import sys
|
||||
|
||||
import os
|
||||
|
||||
|
||||
|
||||
def force_1space(path):
|
||||
|
||||
try:
|
||||
|
||||
with open(path, 'rb') as f:
|
||||
|
||||
content = f.read()
|
||||
|
||||
tokens = list(tokenize.tokenize(io.BytesIO(content).readline))
|
||||
|
||||
except Exception:
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
col_to_level = {0: 0}
|
||||
|
||||
level = 0
|
||||
|
||||
for tok in tokens:
|
||||
|
||||
if tok.type == tokenize.INDENT:
|
||||
|
||||
level += 1
|
||||
|
||||
col_to_level[tok.end[1]] = level
|
||||
|
||||
elif tok.type == tokenize.DEDENT:
|
||||
|
||||
level -= 1
|
||||
|
||||
|
||||
|
||||
new_content = []
|
||||
|
||||
level = 0
|
||||
|
||||
last_line = -1
|
||||
|
||||
last_end = (1, 0)
|
||||
|
||||
|
||||
|
||||
for tok in tokens:
|
||||
|
||||
if tok.type == tokenize.ENCODING:
|
||||
|
||||
continue
|
||||
|
||||
if tok.type == tokenize.ENDMARKER:
|
||||
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user