From 8ea740f3cc872b2585a4ecf97a29127aa9316137 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Wed, 20 Jun 2018 10:14:41 +0200 Subject: Fix log warning regarding repeated disconnection Signed-off-by: Szczepan Zalega --- device.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/device.cc b/device.cc index da54e33..80e4b38 100644 --- a/device.cc +++ b/device.cc @@ -69,8 +69,10 @@ bool Device::_disconnect() { LOG(std::string(__FUNCTION__) + std::string(m_model == DeviceModel::PRO ? "PRO" : "STORAGE"), Loglevel::DEBUG_L2); LOG(std::string(__FUNCTION__) + std::string(" *IN* "), Loglevel::DEBUG_L2); - LOG(std::string("Disconnection: handle already freed: ") + std::to_string(mp_devhandle == nullptr) + " ("+m_path+")", Loglevel::DEBUG_L1); - if(mp_devhandle == nullptr) return false; + if(mp_devhandle == nullptr) { + LOG(std::string("Disconnection: handle already freed: ") + std::to_string(mp_devhandle == nullptr) + " ("+m_path+")", Loglevel::DEBUG_L1); + return false; + } hid_close(mp_devhandle); mp_devhandle = nullptr; -- cgit v1.2.3