handle nulls from libmtp in vendor/product name

This commit is contained in:
Daniel Risacher 2014-04-07 21:26:00 +02:00 committed by Peter Hatina
parent d4105f8fe0
commit cef92acaee
1 changed files with 4 additions and 2 deletions

View File

@ -189,8 +189,10 @@ bool MTPDevice::listDevices()
}
for (int i = 0; i < raw_devices_cnt; ++i) {
std::cout << i + 1 << ": " << raw_devices[i].device_entry.vendor
<< raw_devices[i].device_entry.product << "\n";
std::cout << i + 1 << ": "
<< (raw_devices[i].device_entry.vendor ? raw_devices[i].device_entry.vendor : "Unknown vendor ")
<< (raw_devices[i].device_entry.product ? raw_devices[i].device_entry.product : "Unknown product")
<< "\n";
}
free(static_cast<void*>(raw_devices));