From 8ad40f78a28340ff21d803c185c20a035c341c65 Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Tue, 25 May 2021 19:56:38 +0200 Subject: [PATCH] Only check "printer-state-reasons" if it exists --- qml/pages/utils.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/qml/pages/utils.js b/qml/pages/utils.js index 9190d8c..c5e307b 100644 --- a/qml/pages/utils.js +++ b/qml/pages/utils.js @@ -361,12 +361,15 @@ function isWaringState(printer) return true; } - for(var i in printer.attrs["printer-state-reasons"].value) + if(printer.attrs.hasOwnProperty("printer-state-reasons")) { - var value = printer.attrs["printer-state-reasons"].value[i]; - if(value != "none" && !(endsWith("-report", value))) + for(var i in printer.attrs["printer-state-reasons"].value) { - return true; + var value = printer.attrs["printer-state-reasons"].value[i]; + if(value != "none" && !(endsWith("-report", value))) + { + return true; + } } } return false;