Mutex Not Held During List Size Check

This commit is contained in:
2025-12-09 21:21:44 +01:00
parent 8872902990
commit f9d63a6a3f

View File

@ -92,16 +92,19 @@ void reHDD::app_logic(void)
Drive *reHDD::getSelectedDrive()
{
mxDrives.lock();
if (u16SelectedEntry < listDrives.size())
{
list<Drive>::iterator it = listDrives.begin();
advance(it, u16SelectedEntry);
it->u16DriveIndex = u16SelectedEntry;
mxDrives.unlock();
return &(*it);
}
else
{
Logger::logThis()->warning("selected drive not present");
mxDrives.unlock();
return nullptr;
}
}