FIX: ams_id out of bounds crash

jira: none

Change-Id: Icfc5555e4772cd70a9f018f0c734e2edb8b7d626
This commit is contained in:
liz.li 2024-11-20 19:24:34 +08:00 committed by lane.wei
parent 6ba1518c24
commit aa03f489dc
1 changed files with 3 additions and 2 deletions

View File

@ -3944,12 +3944,13 @@ wxString GUI_App::transition_tridid(int trid_id)
wxString maping_dict[] = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
if (trid_id >= 128 * 4) {
int id_index = 4 + trid_id % 128;
trid_id -= 128 * 4;
int id_index = trid_id / 4;
return wxString::Format("%s", maping_dict[id_index]);
}
else {
int id_index = ceil(trid_id / 4);
int id_suffix = id_suffix = (trid_id + 1) % 4 == 0 ? 4 : (trid_id + 1) % 4;
int id_suffix = trid_id % 4 + 1;
return wxString::Format("%s%d", maping_dict[id_index], id_suffix);
}
}