aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSalanto <62221668+Salanto@users.noreply.github.com>2022-08-20 14:59:05 +0200
committerGitHub <noreply@github.com>2022-08-20 14:59:05 +0200
commit15af6c34ec93bf442a2da8232945c97c1f108506 (patch)
tree100f945f55a0e4250df8eedfe8bb21513a1271cc
parent7746b9593c54757d739df48956dfb6a1cc104739 (diff)
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.
-rw-r--r--src/evidence.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/evidence.cpp b/src/evidence.cpp
index ab3a6a38..4bff79d7 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);