summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2010-12-20 16:02:33 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2010-12-20 16:03:06 (GMT)
commit7747e8864db4518e35d5a472cec37697b85b3b15 (patch)
treec3410141cc124fdd06dc0aa1a7a8c04a730a0a9a /tools
parente8d42e5861bdfd6acec3bf1ccc8d55b09b1cc573 (diff)
downloadQt-7747e8864db4518e35d5a472cec37697b85b3b15.zip
Qt-7747e8864db4518e35d5a472cec37697b85b3b15.tar.gz
Qt-7747e8864db4518e35d5a472cec37697b85b3b15.tar.bz2
runonphone: Check that the device->config is valid before dereferencing it
In some occasions (encountered on OS X), this can be null for some devices. Merge-request: 834 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/runonphone/serenum_unix.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/runonphone/serenum_unix.cpp b/tools/runonphone/serenum_unix.cpp
index db6375e..f65497e 100644
--- a/tools/runonphone/serenum_unix.cpp
+++ b/tools/runonphone/serenum_unix.cpp
@@ -82,7 +82,7 @@ QList<SerialPortId> enumerateSerialPorts(int loglevel)
for (struct usb_bus *bus = usb_get_busses(); bus; bus = bus->next) {
for (struct usb_device *device = bus->devices; device; device = device->next) {
- for (int n = 0; n < device->descriptor.bNumConfigurations; ++n) {
+ for (int n = 0; n < device->descriptor.bNumConfigurations && device->config; ++n) {
struct usb_config_descriptor &usbConfig =device->config[n];
QList<int> usableInterfaces;
for (int m = 0; m < usbConfig.bNumInterfaces; ++m) {