From 15af6c34ec93bf442a2da8232945c97c1f108506 Mon Sep 17 00:00:00 2001 From: Salanto <62221668+Salanto@users.noreply.github.com> Date: Sat, 20 Aug 2022 14:59:05 +0200 Subject: [PATCH] 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. --- src/evidence.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/evidence.cpp b/src/evidence.cpp index ab3a6a3..4bff79d 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -487,7 +487,11 @@ void Courtroom::on_evidence_double_clicked(int p_id) for (AOEvidenceButton *i_button : qAsConst(ui_evidence_list)) 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; evi_type f_evi = local_evidence_list.at(f_real_id);