summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cups.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cups.c b/src/cups.c
index cb2d592..e1027c9 100644
--- a/src/cups.c
+++ b/src/cups.c
@@ -738,8 +738,14 @@ cph_cups_printer_add_with_ppd_file (CphCups *cups,
ippAddString (request, IPP_TAG_PRINTER, IPP_TAG_NAME,
"printer-name", NULL, printer_name);
- ippAddString (request, IPP_TAG_PRINTER, IPP_TAG_URI,
- "device-uri", NULL, printer_uri);
+
+ /* In this specific case of ADD_MODIFY, the URI can be NULL/empty since
+ * we provide a complete PPD. And cups fails if we pass an empty
+ * string. */
+ if (printer_uri && printer_uri[0] != '\0') {
+ ippAddString (request, IPP_TAG_PRINTER, IPP_TAG_URI,
+ "device-uri", NULL, printer_uri);
+ }
if (info && info[0] != '\0') {
ippAddString (request, IPP_TAG_PRINTER, IPP_TAG_TEXT,