Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

NPE at FTDISerialDevice.getBcdDevice() #352

Open
dx-codebreaker opened this issue May 10, 2022 · 0 comments
Open

NPE at FTDISerialDevice.getBcdDevice() #352

dx-codebreaker opened this issue May 10, 2022 · 0 comments

Comments

@dx-codebreaker
Copy link

Fatal Exception: java.lang.NullPointerException Attempt to read from null array com.felhr.usbserial.FTDISerialDevice.getBcdDevice (FTDISerialDevice.java:789) com.felhr.usbserial.FTDISerialDevice.encodedBaudRate (FTDISerialDevice.java:828) com.felhr.usbserial.FTDISerialDevice.setBaudRate (FTDISerialDevice.java:197)

It seems like an NPE check can be added to descriptors object to fix the issue.
https://github.com/felHR85/UsbSerial/blob/master/usbserial/src/main/java/com/felhr/usbserial/FTDISerialDevice.java#L789

byte[] descriptors = connection.getRawDescriptors(); return (short) ((descriptors[13] << 8) + descriptors[12]);

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant