1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-17 11:54:33 +01:00

Fixed NPE during VID/PID discovery for non-USB serial ports

This commit is contained in:
Cristian Maglie 2013-06-13 13:19:26 +02:00
parent ae222c10e7
commit a9e6397e2e

View File

@ -10,7 +10,11 @@ public class UDevAdmParser {
Properties properties = new Properties();
properties.load(new StringReader(output));
return ("0x" + properties.get("ID_VENDOR_ID").toString() + "_0x" + properties.get("ID_MODEL_ID").toString()).toUpperCase();
Object vid = properties.get("ID_VENDOR_ID");
Object pid = properties.get("ID_MODEL_ID");
if (vid == null || pid == null)
return null;
return ("0x" + vid + "_0x" + pid).toUpperCase();
}
}