From a9e6397e2e32c0ba6ec5aeb9b5f06437d3b71b88 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 13 Jun 2013 13:19:26 +0200 Subject: [PATCH] Fixed NPE during VID/PID discovery for non-USB serial ports --- app/src/processing/app/linux/UDevAdmParser.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/processing/app/linux/UDevAdmParser.java b/app/src/processing/app/linux/UDevAdmParser.java index 147c13bff..53793f83a 100644 --- a/app/src/processing/app/linux/UDevAdmParser.java +++ b/app/src/processing/app/linux/UDevAdmParser.java @@ -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(); } }