WiimoteReal: Check for error before discarding report
This commit is contained in:
parent
25c85d827a
commit
fba8bfe6a6
|
@ -281,6 +281,14 @@ void Wiimote::Read()
|
|||
Report rpt(MAX_PAYLOAD);
|
||||
auto const result = IORead(rpt.data());
|
||||
|
||||
if (0 == result)
|
||||
{
|
||||
ERROR_LOG_FMT(WIIMOTE, "Wiimote::IORead failed. Disconnecting Wii Remote {}.", m_index + 1);
|
||||
DisconnectInternal();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Drop the report if not connected.
|
||||
if (!m_is_linked)
|
||||
return;
|
||||
|
@ -298,11 +306,6 @@ void Wiimote::Read()
|
|||
rpt.resize(result);
|
||||
m_read_reports.Push(std::move(rpt));
|
||||
}
|
||||
else if (0 == result)
|
||||
{
|
||||
ERROR_LOG_FMT(WIIMOTE, "Wiimote::IORead failed. Disconnecting Wii Remote {}.", m_index + 1);
|
||||
DisconnectInternal();
|
||||
}
|
||||
}
|
||||
|
||||
bool Wiimote::Write()
|
||||
|
|
Loading…
Reference in New Issue