Merge pull request #12833 from merryhime/vsync-crash

configure_graphics: Avoid crash when vsync_mode_combobox is empty
This commit is contained in:
liamwhite 2024-01-28 15:02:15 -05:00 committed by GitHub
commit e687ca8735
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 0 deletions

View File

@ -224,6 +224,11 @@ void ConfigureGraphics::PopulateVSyncModeSelection(bool use_setting) {
} }
void ConfigureGraphics::UpdateVsyncSetting() const { void ConfigureGraphics::UpdateVsyncSetting() const {
const Settings::RendererBackend backend{GetCurrentGraphicsBackend()};
if (backend == Settings::RendererBackend::Null) {
return;
}
const auto mode = vsync_mode_combobox_enum_map[vsync_mode_combobox->currentIndex()]; const auto mode = vsync_mode_combobox_enum_map[vsync_mode_combobox->currentIndex()];
const auto vsync_mode = PresentModeToSetting(mode); const auto vsync_mode = PresentModeToSetting(mode);
Settings::values.vsync_mode.SetValue(vsync_mode); Settings::values.vsync_mode.SetValue(vsync_mode);