aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Mohammed <fossfreedom@ubuntu.com>2021-12-23 20:27:50 +0000
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2022-02-08 22:00:25 +0100
commit6f549014e542afbfdda6d5311d4837ec8cf0479c (patch)
tree8296edc09684c6947e0770a66a115da987f544a5
parent264f7af36ce238d414b27587645d5b8cde0f54a4 (diff)
downloadayatana-indicator-printers-6f549014e542afbfdda6d5311d4837ec8cf0479c.tar.gz
ayatana-indicator-printers-6f549014e542afbfdda6d5311d4837ec8cf0479c.tar.bz2
ayatana-indicator-printers-6f549014e542afbfdda6d5311d4837ec8cf0479c.zip
Check if valid cupsoption before processing - closes #12
-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);
}