From 707d6a9683cc4fd29a96fc3632d167ec1bf79215 Mon Sep 17 00:00:00 2001 From: FlafyDev Date: Fri, 31 May 2024 16:07:01 +0300 Subject: [PATCH] fix; Crash on editor settings --- changelog.md | 5 +++++ src/hooks/custom_song_widget.cpp | 15 +++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index ef80f44..0a152ea 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # Changelog +## v0.1.2 +###### 31-05-2024 + +- Fixed a crash on Editor settings + ## v0.1.1 ###### 31-05-2024 diff --git a/src/hooks/custom_song_widget.cpp b/src/hooks/custom_song_widget.cpp index 6ff1eb7..021dc07 100644 --- a/src/hooks/custom_song_widget.cpp +++ b/src/hooks/custom_song_widget.cpp @@ -15,18 +15,21 @@ struct ANCustomSongWidget : geode::Modify for (const auto &pair : m_songs) { songIds.insert(pair.first); } - songIds.insert(m_songInfoObject->m_songID); + if (m_songInfoObject != nullptr) { + songIds.insert(m_songInfoObject->m_songID); + } return songIds; } void updateSongInfo() { CustomSongWidget::updateSongInfo(); if (!m_fields->m_showNong) { - m_fields->m_showColored = AutoNongManager::get()->anySongExists(getSongIds()); - m_fields->m_showNong = !m_isMusicLibrary && !m_showPlayMusicBtn && - GameManager::get()->m_levelEditorLayer == nullptr && - (Mod::get()->getSettingValue("always-show-auto-nong-btn") || - m_fields->m_showColored); + bool showAny = !m_isMusicLibrary && !m_showPlayMusicBtn && + GameManager::get()->m_levelEditorLayer == nullptr; + m_fields->m_showColored = showAny && AutoNongManager::get()->anySongExists(getSongIds()); + m_fields->m_showNong = + showAny && (Mod::get()->getSettingValue("always-show-auto-nong-btn") || + m_fields->m_showColored); if (m_fields->m_showNong) { if (m_fields->m_showColored) { this->scheduleOnce(schedule_selector(ANCustomSongWidget::showPopup), 0.2);