mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 03:06:00 +08:00
Fix indexing error in CrashHandler
CURA-4895
This commit is contained in:
parent
1e1f49ad53
commit
8ffd5442e7
@ -262,8 +262,8 @@ class CrashHandler:
|
|||||||
layout = QVBoxLayout()
|
layout = QVBoxLayout()
|
||||||
|
|
||||||
text_area = QTextEdit()
|
text_area = QTextEdit()
|
||||||
trace_dict = traceback.format_exception(self.exception_type, self.value, self.traceback)
|
trace_list = traceback.format_exception(self.exception_type, self.value, self.traceback)
|
||||||
trace = "".join(trace_dict)
|
trace = "".join(trace_list)
|
||||||
text_area.setText(trace)
|
text_area.setText(trace)
|
||||||
text_area.setReadOnly(True)
|
text_area.setReadOnly(True)
|
||||||
|
|
||||||
@ -271,14 +271,28 @@ class CrashHandler:
|
|||||||
group.setLayout(layout)
|
group.setLayout(layout)
|
||||||
|
|
||||||
# Parsing all the information to fill the dictionary
|
# Parsing all the information to fill the dictionary
|
||||||
summary = trace_dict[len(trace_dict)-1].rstrip("\n")
|
summary = ""
|
||||||
module = trace_dict[len(trace_dict)-2].rstrip("\n").split("\n")
|
if len(trace_list) >= 1:
|
||||||
|
summary = trace_list[len(trace_list)-1].rstrip("\n")
|
||||||
|
module = [""]
|
||||||
|
if len(trace_list) >= 2:
|
||||||
|
module = trace_list[len(trace_list)-2].rstrip("\n").split("\n")
|
||||||
module_split = module[0].split(", ")
|
module_split = module[0].split(", ")
|
||||||
filepath = module_split[0].split("\"")[1]
|
|
||||||
|
filepath_directory_split = module_split[0].split("\"")
|
||||||
|
filepath = ""
|
||||||
|
if len(filepath_directory_split) > 1:
|
||||||
|
filepath = filepath_directory_split[1]
|
||||||
directory, filename = os.path.split(filepath)
|
directory, filename = os.path.split(filepath)
|
||||||
line = int(module_split[1].lstrip("line "))
|
line = ""
|
||||||
function = module_split[2].lstrip("in ")
|
if len(module_split) > 1:
|
||||||
code = module[1].lstrip(" ")
|
line = int(module_split[1].lstrip("line "))
|
||||||
|
function = ""
|
||||||
|
if len(module_split) > 2:
|
||||||
|
function = module_split[2].lstrip("in ")
|
||||||
|
code = ""
|
||||||
|
if len(module) > 1:
|
||||||
|
code = module[1].lstrip(" ")
|
||||||
|
|
||||||
# Using this workaround for a cross-platform path splitting
|
# Using this workaround for a cross-platform path splitting
|
||||||
split_path = []
|
split_path = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user