Merge lp:~azzar1/indicator-printers/fix-1703046 into lp:indicator-printers

Proposed by Andrea Azzarone
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 84
Merged at revision: 84
Proposed branch: lp:~azzar1/indicator-printers/fix-1703046
Merge into: lp:indicator-printers
Diff against target: 20 lines (+6/-3)
1 file modified
src/indicator-printers-menu.c (+6/-3)
To merge this branch: bzr merge lp:~azzar1/indicator-printers/fix-1703046
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
Review via email: mp+332554@code.launchpad.net

Commit message

According to the documentation cupsGetOptions can return NULL. Do not crash if it happens.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Ack!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/indicator-printers-menu.c'
--- src/indicator-printers-menu.c 2012-03-03 10:40:46 +0000
+++ src/indicator-printers-menu.c 2017-10-20 09:39:59 +0000
@@ -220,10 +220,13 @@
220220
221 ndests = cupsGetDests (&dests);221 ndests = cupsGetDests (&dests);
222 for (i = 0; i < ndests; i++) {222 for (i = 0; i < ndests; i++) {
223 int state = atoi (cupsGetOption ("printer-state",223 const char *val = cupsGetOption ("printer-state",
224 dests[i].num_options,224 dests[i].num_options,
225 dests[i].options));225 dests[i].options);
226 update_printer_menuitem (self, dests[i].name, state);226 if (val != NULL) {
227 int state = atoi (val);
228 update_printer_menuitem (self, dests[i].name, state);
229 }
227 }230 }
228 cupsFreeDests (ndests, dests);231 cupsFreeDests (ndests, dests);
229}232}

Subscribers

People subscribed via source and target branches