aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/indicator-printers-menu.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/indicator-printers-menu.c b/src/indicator-printers-menu.c
index 54ea281..bf0bc07 100644
--- a/src/indicator-printers-menu.c
+++ b/src/indicator-printers-menu.c
@@ -215,10 +215,13 @@ update_all_printer_menuitems (IndicatorPrintersMenu *self)
ndests = cupsGetDests (&dests);
for (i = 0; i < ndests; i++) {
- int state = atoi (cupsGetOption ("printer-state",
- dests[i].num_options,
- dests[i].options));
- update_printer_menuitem (self, dests[i].name, state);
+ const char *option = cupsGetOption ("printer-state",
+ dests[i].num_options,
+ dests[i].options);
+ if (option != NULL) {
+ int state = atoi (option);
+ update_printer_menuitem (self, dests[i].name, state);
+ }
}
cupsFreeDests (ndests, dests);
}