mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Make sure to close underlying com if we fail to open
This commit is contained in:
+3
-1
@@ -151,13 +151,15 @@ bool Device::open() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(!serial) {
|
if(!serial) {
|
||||||
err(APIError::NoSerialNumber);
|
err(APIError::NoSerialNumber); // Communication could not be established with the device. Perhaps it is not powered with 12 volts?
|
||||||
|
com->close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string currentSerial = getNeoDevice().serial;
|
std::string currentSerial = getNeoDevice().serial;
|
||||||
if(currentSerial != serial->deviceSerial) {
|
if(currentSerial != serial->deviceSerial) {
|
||||||
err(APIError::IncorrectSerialNumber);
|
err(APIError::IncorrectSerialNumber);
|
||||||
|
com->close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user