Blob Blame History Raw
From 1941fbe90be65ea6fab393bdfeed6a8bf30dbab8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Thu, 14 Dec 2023 12:52:26 +0100
Subject: [PATCH] Avoid "KeyError: material_name" crash in Fedora

    Traceback (most recent call last):
      File "/usr/lib/python3.11/site-packages/UM/Qt/ListModel.py", line 54, in data
        return self._items[index.row()][self._role_names[role].decode("utf-8")]
               ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    KeyError: 'material_name'

Downstream report: https://bugzilla.redhat.com/show_bug.cgi?id=2252195
Community: https://community.ultimaker.com/topic/44538-cura-53-crashs-at-startup/

For reasons unknown, this crash does not happen with the AppImage.

Nevertheless, in 2baada8a70b15dd87948a25855e17d15b0ece58c
material_name was added as a role, not material_label.
Reaming the field in the sentinel extruder makes the crash go away.
---
 cura/Machines/Models/ExtrudersModel.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cura/Machines/Models/ExtrudersModel.py b/cura/Machines/Models/ExtrudersModel.py
index 2677894bff2..f31f7c87178 100644
--- a/cura/Machines/Models/ExtrudersModel.py
+++ b/cura/Machines/Models/ExtrudersModel.py
@@ -227,7 +227,7 @@ def __updateExtruders(self):
                     "material_brand": "",
                     "color_name": "",
                     "material_type": "",
-                    "material_label": ""
+                    "material_name": ""
                 }
                 items.append(item)
             if self._items != items: