[idd] helper: fix crash when saving invalid values

This commit is contained in:
Quantum authored and Geoffrey McRae committed 2025-11-09 03:34:24 +11:00
1 parent 6c70e36cb1
commit fad7af7740
1 file changed
+11 -3
+11 -3
View File
@@ -178,9 +178,17 @@ LRESULT CConfigWindow::onCommand(WORD id, WORD code, HWND hwnd)
int index = m_modeBox->getData(sel);
auto &mode = index >= 0 ? (*m_modes)[index] : m_modes->emplace_back();
mode.width = m_modeWidth->getNumericValue();
mode.height = m_modeHeight->getNumericValue();
mode.refresh = m_modeRefresh->getNumericValue();
try
{
mode.width = m_modeWidth->getNumericValue();
mode.height = m_modeHeight->getNumericValue();
mode.refresh = m_modeRefresh->getNumericValue();
}
catch (std::logic_error&)
{
return 0;
}
if (index >= 0)
m_modeBox->delItem(sel);