@@ -177,13 +177,19 @@ void MLRSongCell::onPlaySong(CCObject*) {
177177
178178void MLRSongCell::updateProgressBar () const {
179179 SongManager& songManager = SongManager::get ();
180+ if (!songManager.getFinishedCalculatingSongLengths () || !this ->m_currentB || !this ->m_totalBar ) return ;
181+ geode::log::info (" foobar songManager" );
180182 FMODAudioEngine* fmod = FMODAudioEngine::get ();
183+ geode::log::info (" foobar fmod" );
181184 const std::string& currSong = songManager.getCurrentSong ();
182- if (fmod->getActiveMusic (0 ) == currSong && songManager.getSongToSongDataEntries ().contains (currSong)) {
183- const int fullLength = songManager.getSongToSongDataEntries ().find (songManager.getCurrentSong ())->second .songLength ;
184- const int lastPosition = songManager.getLastMenuLoopPosition ();
185- this ->m_currentB ->setContentWidth (((1 .f * lastPosition) / (1 .f * fullLength)) * this ->m_totalBar ->getContentWidth ());
186- }
185+ geode::log::info (" currSong: {}" , currSong);
186+ if (fmod->getActiveMusic (0 ) != currSong || !songManager.getSongToSongDataEntries ().contains (currSong)) return ;
187+ geode::log::info (" no more early return" );
188+ const int fullLength = songManager.getSongToSongDataEntries ().find (songManager.getCurrentSong ())->second .songLength ;
189+ geode::log::info (" found fullLength: {}" , fullLength);
190+ const int lastPosition = songManager.getLastMenuLoopPosition ();
191+ geode::log::info (" found lastPosition: {}" , lastPosition);
192+ this ->m_currentB ->setContentWidth (((1 .f * lastPosition) / (1 .f * fullLength)) * this ->m_totalBar ->getContentWidth ());
187193}
188194
189195void MLRSongCell::checkIfCurrentSong () const {
0 commit comments