Skip to content

Commit 650f46a

Browse files
committed
Fix crash when the module is disabled
1 parent 4355172 commit 650f46a

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

shared/Patches/PColorNoteVisuals.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace QBeatSaberPlus_NoteTweaker::Patches {
3030
static void SetDotScaleFromConfig(std::shared_ptr<NTConfig::_Profile>& p_Profile);
3131
static void SetDotColorsFromConfig(std::shared_ptr<NTConfig::_Profile>& p_Profile);
3232

33-
private:
33+
public:
3434
/// @brief Init specific data and register events
3535
static void Init();
3636

src/Patches/PColorNoteVisuals.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,15 @@ namespace QBeatSaberPlus_NoteTweaker::Patches {
154154

155155
if (!PColorNoteVisuals_WasInit)
156156
{
157-
CP_SDK::ChatPlexSDK::OnGenericSceneChange += [](CP_SDK::EGenericScene x) { if (x == CP_SDK::EGenericScene::Menu) PColorNoteVisuals_Cache.clear(); };
157+
CP_SDK::ChatPlexSDK::OnGenericSceneChange += [](CP_SDK::EGenericScene x)
158+
{
159+
if (x != CP_SDK::EGenericScene::Menu)
160+
return;
161+
162+
if (!PColorNoteVisuals_Cache.empty())
163+
PColorNoteVisuals_Cache.clear();
164+
};
165+
158166
PColorNoteVisuals_WasInit = true;
159167
}
160168
}
@@ -179,6 +187,9 @@ namespace QBeatSaberPlus_NoteTweaker::Patches {
179187
break;
180188
}
181189

190+
if (!PColorNoteVisuals_WasInit)
191+
PColorNoteVisuals::Init();
192+
182193
if (!l_Cache || l_Cache->colorNoteVisuals != __Instance)
183194
{
184195
PColorNoteVisuals_Cache.push_back({

0 commit comments

Comments
 (0)