Skip to content

Commit 4d54a6b

Browse files
committed
Fix qml warnings when there is no active machine (yet)
1 parent 224416f commit 4d54a6b

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

resources/qml/ExtruderTabs.qml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ TabRow
1515
property bool hasMaterials:
1616
{
1717
if (CuraSDKVersion >= "6.2.0") {
18-
return Cura.MachineManager.activeMachine.hasMaterials
18+
return (Cura.MachineManager.activeMachine != null) ? Cura.MachineManager.activeMachine.hasMaterials : false
1919
} else {
2020
return Cura.MachineManager.hasMaterials
2121
}
2222
}
2323
property bool hasVariants:
2424
{
2525
if (CuraSDKVersion >= "6.2.0") {
26-
return Cura.MachineManager.activeMachine.hasVariants
26+
return (Cura.MachineManager.activeMachine != null) ? Cura.MachineManager.activeMachine.hasVariants : false
2727
} else {
2828
return Cura.MachineManager.hasVariants
2929
}
@@ -102,7 +102,7 @@ TabRow
102102
property var extruderStack:
103103
{
104104
if (CuraSDKVersion >= "6.2.0") {
105-
return Cura.MachineManager.activeMachine.extruders[model.index];
105+
return (Cura.MachineManager.activeMachine != null) ? Cura.MachineManager.activeMachine.extruders[model.index] : undefined;
106106
} else {
107107
return Cura.MachineManager.getExtruder(model.index);
108108
}

resources/qml/PrintSetupSummary.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ Cura.RoundedRectangle
7575
property bool hasMaterials:
7676
{
7777
if (CuraSDKVersion >= "6.2.0") {
78-
return Cura.MachineManager.activeMachine.hasMaterials
78+
return (Cura.MachineManager.activeMachine != null) ? Cura.MachineManager.activeMachine.hasMaterials : false
7979
} else {
8080
return Cura.MachineManager.hasMaterials
8181
}
8282
}
8383
property bool hasVariants:
8484
{
8585
if (CuraSDKVersion >= "6.2.0") {
86-
return Cura.MachineManager.activeMachine.hasVariants
86+
return (Cura.MachineManager.activeMachine != null) ? Cura.MachineManager.activeMachine.hasVariants : false
8787
} else {
8888
return Cura.MachineManager.hasVariants
8989
}

0 commit comments

Comments
 (0)