Fix TypeError in JobSpec.qml due to material cost being undefined

This commit is contained in:
Lipu Fei 2017-05-03 10:45:39 +02:00
parent 0452cffff9
commit ac560229a1

View file

@ -212,8 +212,9 @@ Item {
{ {
lengths.push(base.printMaterialLengths[index].toFixed(2)); lengths.push(base.printMaterialLengths[index].toFixed(2));
weights.push(String(Math.floor(base.printMaterialWeights[index]))); weights.push(String(Math.floor(base.printMaterialWeights[index])));
costs.push(base.printMaterialCosts[index].toFixed(2)); var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2);
if(base.printMaterialCosts[index] > 0) costs.push(cost);
if(cost > 0)
{ {
someCostsKnown = true; someCostsKnown = true;
} }