mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-10 00:41:19 +12:00
Fix a crash from writing to a disconnected device
This commit is contained in:
parent
55e240339c
commit
e14c54b846
1 changed files with 6 additions and 3 deletions
|
@ -955,14 +955,17 @@ void WiimoteControllerProvider::writer_thread()
|
|||
if (index != (size_t)-1 && !data.empty())
|
||||
{
|
||||
auto& wiimote = m_wiimotes[index];
|
||||
if (!wiimote.device)
|
||||
continue;
|
||||
if (wiimote.rumble)
|
||||
data[1] |= 1;
|
||||
if (!wiimote.device->write_data(data))
|
||||
{
|
||||
wiimote.device.reset();
|
||||
if (wiimote.device)
|
||||
wiimote.data_ts = std::chrono::high_resolution_clock::now();
|
||||
else
|
||||
wiimote.rumble = false;
|
||||
}
|
||||
else
|
||||
wiimote.data_ts = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
device_lock.unlock();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue