aboutsummaryrefslogtreecommitdiff
path: root/NitrokeyManager.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-01-23 18:40:10 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2017-03-11 15:41:39 +0100
commit4f0ae6f59bc086f5ac9a1af14195b54c397641b2 (patch)
tree6381453f9e0a3377babd9ea2474303c637e47dc3 /NitrokeyManager.cc
parent3d54b4ea0c96a2420973dc840c1b32545bf2b05d (diff)
downloadlibnitrokey-4f0ae6f59bc086f5ac9a1af14195b54c397641b2.tar.gz
libnitrokey-4f0ae6f59bc086f5ac9a1af14195b54c397641b2.tar.bz2
Throw on not connected device when requesting model
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r--NitrokeyManager.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index d85af91..e0e6ae3 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -617,6 +617,9 @@ namespace nitrokey{
DeviceModel NitrokeyManager::get_connected_device_model() const{
//FIXME throw if no device is connected or return unknown/unconnected value
+ if (device == nullptr){
+ throw std::runtime_error("device not connected");
+ }
return device->get_device_model();
}