Fix: Wrong type cast for selected AI/GS script info in AIListWindow

This resulted in technically undefined behaviour when listing GSs
This commit is contained in:
Jonathan G Rennison 2022-12-22 19:25:47 +00:00 committed by rubidium42
parent d4c530904c
commit 14c1266bbc
1 changed files with 2 additions and 2 deletions

View File

@ -142,11 +142,11 @@ struct AIListWindow : public Window {
break;
}
case WID_AIL_INFO_BG: {
AIInfo *selected_info = nullptr;
ScriptInfo *selected_info = nullptr;
int i = 0;
for (const auto &item : *this->info_list) {
i++;
if (this->selected == i - 1) selected_info = static_cast<AIInfo *>(item.second);
if (this->selected == i - 1) selected_info = static_cast<ScriptInfo *>(item.second);
}
/* Some info about the currently selected AI. */
if (selected_info != nullptr) {