SenseApiMgr: Print dev info when detaching, use early return pattern

This commit is contained in:
2025-07-30 10:33:50 -04:00
parent a2598e80fd
commit 49c8b5bca1
+8 -6
View File
@@ -312,15 +312,17 @@ static int xcbWindow_detachDeviceReq(const smo::device::SenseDeviceSpec& spec)
}
);
if (it != g_attachedWindows.end())
if (it == g_attachedWindows.end())
{
g_attachedWindows.erase(it);
std::cout << __func__ << ": Detached X11 window device\n";
return 0;
std::cerr << __func__ << ": Device not found for detachment:\n"
<< spec.stringify() << "\n";
return -1;
}
std::cerr << __func__ << ": Device not found for detachment\n";
return -1;
g_attachedWindows.erase(it);
std::cout << __func__ << ": Detached X11 window device:\n"
<< spec.stringify() << "\n";
return 0;
}
// SenseApi descriptor