Qt: fix access to uninitialized Pad object

Fixes a crash when opening the pad settings before the pad handlers are initialized.
This commit is contained in:
Megamouse 2022-04-21 23:43:39 +02:00
parent f42e647430
commit 6a67155404
1 changed files with 6 additions and 1 deletions

View File

@ -1694,7 +1694,12 @@ bool pad_settings_dialog::GetIsLddPad(u32 index) const
std::lock_guard lock(pad::g_pad_mutex);
if (const auto handler = pad::get_current_handler(true))
{
return handler->GetPads().at(index)->ldd;
ensure(index < handler->GetPads().size());
if (const std::shared_ptr<Pad> pad = handler->GetPads().at(index))
{
return pad->ldd;
}
}
}