mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 06:45:09 -06:00
Fix indexing error in CrashHandler
CURA-4895
This commit is contained in:
parent
1e1f49ad53
commit
8ffd5442e7
1 changed files with 22 additions and 8 deletions
|
@ -262,8 +262,8 @@ class CrashHandler:
|
|||
layout = QVBoxLayout()
|
||||
|
||||
text_area = QTextEdit()
|
||||
trace_dict = traceback.format_exception(self.exception_type, self.value, self.traceback)
|
||||
trace = "".join(trace_dict)
|
||||
trace_list = traceback.format_exception(self.exception_type, self.value, self.traceback)
|
||||
trace = "".join(trace_list)
|
||||
text_area.setText(trace)
|
||||
text_area.setReadOnly(True)
|
||||
|
||||
|
@ -271,14 +271,28 @@ class CrashHandler:
|
|||
group.setLayout(layout)
|
||||
|
||||
# Parsing all the information to fill the dictionary
|
||||
summary = trace_dict[len(trace_dict)-1].rstrip("\n")
|
||||
module = trace_dict[len(trace_dict)-2].rstrip("\n").split("\n")
|
||||
summary = ""
|
||||
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(", ")
|
||||
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)
|
||||
line = int(module_split[1].lstrip("line "))
|
||||
function = module_split[2].lstrip("in ")
|
||||
code = module[1].lstrip(" ")
|
||||
line = ""
|
||||
if len(module_split) > 1:
|
||||
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
|
||||
split_path = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue