Skip to content

Commit

Permalink
better defense
Browse files Browse the repository at this point in the history
  • Loading branch information
mjn-mixael committed Jan 30, 2024
1 parent 0190fda commit de3e382
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fred2/customstringsdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,12 @@ bool CustomStringsDlg::key_edit_box_has_valid_data(bool update)
const CString key = cs.name.c_str();
if (update) {
const int index = m_data_lister.GetCurSel();

if (!SCP_vector_inbounds(m_lister_keys, index)) {
MessageBox("Must select an item to update!");
return false;
}

const auto& this_key = m_lister_keys[index];
if (!strcmp(this_key.c_str(), key)) {
continue;
Expand Down

0 comments on commit de3e382

Please sign in to comment.