Skip to content

Commit 76f450f

Browse files
committed
Fix printer listing on empty CUPS Description
Closes #94
1 parent b30beb7 commit 76f450f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/qz/utils/ShellUtilities.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,11 @@ public static HashMap<String, String> getCupsPrinters() {
192192
for(String prop : props.split("\\r?\\n")) {
193193
if (prop.startsWith(lookFor)) {
194194
String[] desc = prop.split(lookFor);
195-
// cache the description so we can map it to the actual printer name
196-
descMap.put(entry.getKey(), desc[desc.length - 1].trim());
197-
log.info(entry.getKey() + ": " + desc[desc.length - 1]);
195+
if (desc.length > 0) {
196+
// cache the description so we can map it to the actual printer name
197+
descMap.put(entry.getKey(), desc[desc.length - 1].trim());
198+
log.info(entry.getKey() + ": " + desc[desc.length - 1].trim());
199+
}
198200
}
199201
}
200202
}

0 commit comments

Comments
 (0)