Hitting the emergency exit (#861)

Don't change the widget state when the ID exceeds the current widget list due to pages being changed while evidence is being edited.
This commit is contained in:
Salanto 2022-08-20 14:59:05 +02:00 committed by GitHub
parent 7746b9593c
commit 15af6c34ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -487,7 +487,11 @@ void Courtroom::on_evidence_double_clicked(int p_id)
for (AOEvidenceButton *i_button : qAsConst(ui_evidence_list)) for (AOEvidenceButton *i_button : qAsConst(ui_evidence_list))
i_button->set_selected(false); i_button->set_selected(false);
ui_evidence_list.at(p_id)->set_selected(true); // We have to check if the ID is on the currently displayed page.
// This is because SOMEONE allowed the switching of pages while evidence is still being edited.
if (p_id < ui_evidence_list.count()) {
ui_evidence_list.at(p_id)->set_selected(true);
}
current_evidence = f_real_id; current_evidence = f_real_id;
evi_type f_evi = local_evidence_list.at(f_real_id); evi_type f_evi = local_evidence_list.at(f_real_id);