Fix map texture leak

This commit is contained in:
erorcun 2021-06-27 00:34:46 +03:00
parent 4819d195d8
commit a923728877

View file

@ -3653,7 +3653,9 @@ CMenuManager::LoadAllTextures()
#ifdef MENU_MAP
static bool menuOptionAdded = false;
for (int i = 0; i < ARRAY_SIZE(MapFilenames); i++) {
if (!menuOptionAdded && RwTextureRead(MapFilenames[i][0], MapFilenames[i][1])) {
RwTexture *firstTile;
if (!menuOptionAdded && (firstTile = RwTextureRead(MapFilenames[i][0], MapFilenames[i][1]))) {
RwTextureDestroy(firstTile);
FrontendOptionSetCursor(MENUPAGE_PAUSE_MENU, 2, false);
FrontendOptionAddBuiltinAction("FEG_MAP", MENUACTION_CHANGEMENU, MENUPAGE_MAP, SAVESLOT_NONE);
menuOptionAdded = true;