diff options
author | David Mohammed <fossfreedom@ubuntu.com> | 2021-12-23 20:27:50 +0000 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2022-02-08 22:00:25 +0100 |
commit | 6f549014e542afbfdda6d5311d4837ec8cf0479c (patch) | |
tree | 8296edc09684c6947e0770a66a115da987f544a5 | |
parent | 264f7af36ce238d414b27587645d5b8cde0f54a4 (diff) | |
download | ayatana-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.c | 11 |
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); } |