Skip to content

Commit

Permalink
Fix NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric de Launois committed Feb 24, 2025
1 parent ee0457b commit aa4c52e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>org.delaunois</groupId>
<artifactId>brotherql</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<packaging>jar</packaging>
<licenses>
<license>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ public BrotherQLDeviceUsb(URI uri) {
throw new LibUsbException(Rx.msg("libusb.initerror"), result);
LibUsb.setOption(context, LibUsb.OPTION_LOG_LEVEL, LibUsb.LOG_LEVEL_INFO);

if (!"usb".equals(uri.getScheme())) {
throw new IllegalArgumentException("Only usb supported");
}

if (!"Brother".equals(uri.getHost())) {
throw new IllegalArgumentException("Only Brother printers supported");
if (uri != null) {
if (!"usb".equals(uri.getScheme())) {
throw new IllegalArgumentException("Only usb supported");
}

if (!"Brother".equals(uri.getHost())) {
throw new IllegalArgumentException("Only Brother printers supported");
}
}
}

Expand Down

0 comments on commit aa4c52e

Please sign in to comment.