FIX: ams_id out of bounds crash

jira: none

Change-Id: Icfc5555e4772cd70a9f018f0c734e2edb8b7d626
(cherry picked from commit aa03f489dcc6bd737d2d12c53adfb90a01270d66)
This commit is contained in:
liz.li 2024-11-20 19:24:34 +08:00 committed by Noisyfox
parent 1f41e18d7f
commit 58c2ee4f06

View file

@ -3679,12 +3679,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);
}
}