Only check "printer-state-reasons" if it exists

This commit is contained in:
Anton Thomasson 2021-05-25 19:56:38 +02:00
parent 0bd35d647c
commit 8ad40f78a2

View file

@ -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;