diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2020-06-13 18:57:55 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2020-06-13 18:57:55 +0200 |
commit | 712c82ee94d1ef0d96becfce9bc1a7f8d95bdac1 (patch) | |
tree | aa8fe2302bd7d005c2788566c5ba2952cc3a54f8 | |
parent | 8009c37af6198e712e458d0810fe5eae4b2f0ee6 (diff) | |
parent | a3fd24ff87eeae3d320e3ee48f1c6e1b9ba0a783 (diff) | |
download | libnitrokey-712c82ee94d1ef0d96becfce9bc1a7f8d95bdac1.tar.gz libnitrokey-712c82ee94d1ef0d96becfce9bc1a7f8d95bdac1.tar.bz2 |
Merge branch 'enumerate'
Check for null pointer in the provided data
Fixes #168
-rw-r--r-- | device.cc | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -233,7 +233,10 @@ namespace { auto pInfo = hid_enumerate(vendor_id, 0); auto pInfo_ = pInfo; while (pInfo != nullptr){ - auto deviceModel = product_id_to_model(vendor_id, pInfo->product_id); + if (pInfo->path == nullptr || pInfo->serial_number == nullptr) { + continue; + } + auto deviceModel = product_id_to_model(vendor_id, pInfo->product_id); if (deviceModel.has_value()) { std::string path(pInfo->path); std::wstring serialNumberW(pInfo->serial_number); |