Skip to content

Commit

Permalink
Fix crash when LevelInfoLayer::onBack is called
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaghettDev committed Feb 9, 2024
1 parent 3191c80 commit 805fc85
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [1.6.2] - 2024-02-09

### Fixed

- Crash when leaving LevelInfoLayer

## [1.6.1-beta.3] - 2024-02-07

### Changed
Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"win": "2.204",
"android": "2.205"
},
"version": "v1.6.1-beta.3",
"version": "v1.6.2",
"id": "spaghettdev.gd-roulette",
"name": "GD-Roulette",
"developer": "SpaghettDev",
Expand Down
20 changes: 10 additions & 10 deletions src/layers/LevelInfoLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ class $modify(LevelInfoLayer)

void onBack(CCObject* sender)
{
if (levelIDs.size() != 1)
levelIDs.pop_back();

if (g_rouletteManager.isPlayingRoulette && g_rouletteManager.rouletteLayer && levelIDs.back() == g_rouletteManager.currentLevelID)
if (g_rouletteManager.isPlayingRoulette)
{
as<CCLabelBMFont*>(
g_rouletteManager.rouletteLayer->m_pPlayingMenu->getChildByTag(20)
)->setString(fmt::format("{}%", g_rouletteManager.levelPercentageGoal).c_str());
}
if (levelIDs.size() != 0)
levelIDs.pop_back();

if (levelIDs.size() == 1)
levelIDs.pop_back();
if (g_rouletteManager.rouletteLayer && levelIDs.back() == g_rouletteManager.currentLevelID)
{
as<CCLabelBMFont*>(
g_rouletteManager.rouletteLayer->m_pPlayingMenu->getChildByTag(20)
)->setString(fmt::format("{}%", g_rouletteManager.levelPercentageGoal).c_str());
}
}

LevelInfoLayer::onBack(sender);
}
Expand Down

0 comments on commit 805fc85

Please sign in to comment.