Merge pull request #14469 from OatmealDome/backend-warning

GeneralWidget: Add protections against invalid values in BackendWarning()
This commit is contained in:
OatmealDome 2026-03-15 20:13:41 -04:00 committed by GitHub
commit 4dc5ead172
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -173,8 +173,20 @@ void GeneralWidget::BackendWarning()
{
if (Config::GetActiveLayerForConfig(Config::MAIN_GFX_BACKEND) == Config::LayerType::Base)
{
auto warningMessage = VideoBackendBase::GetAvailableBackends()[m_backend_combo->currentIndex()]
->GetWarningMessage();
const auto& backends = VideoBackendBase::GetAvailableBackends();
if (backends.empty())
{
return;
}
const int current_idx = m_backend_combo->currentIndex();
if (current_idx == -1)
{
// Don't attempt to get the current backend if it doesn't match any available backends.
return;
}
auto warningMessage = backends[current_idx]->GetWarningMessage();
if (warningMessage)
{
ModalMessageBox confirm_sw(this);