From b2540d0daf7cfd29fa4ea4085b920f6f357eabbc Mon Sep 17 00:00:00 2001 From: FernTheDev <15272073+Fernthedev@users.noreply.github.com> Date: Wed, 8 Jan 2025 23:58:19 -0400 Subject: [PATCH] Fix null refs --- src/hooks/colorizer/Saber/SaberBurnMarkArea.cpp | 6 ++++-- src/hooks/colorizer/Saber/SaberBurnMarkSparkles.cpp | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/hooks/colorizer/Saber/SaberBurnMarkArea.cpp b/src/hooks/colorizer/Saber/SaberBurnMarkArea.cpp index 49776a5..b404269 100644 --- a/src/hooks/colorizer/Saber/SaberBurnMarkArea.cpp +++ b/src/hooks/colorizer/Saber/SaberBurnMarkArea.cpp @@ -35,8 +35,10 @@ void OnSaberColorChanged_SaberBurnMarkArea(int saberType, Sombrero::FastColor::RGBToHSV(color, h, s, _); Sombrero::FastColor effectColor = Sombrero::FastColor::HSVToRGB(h, s, 1); int intType = saberType; - lineRenderers[intType]->set_startColor(effectColor); - lineRenderers[intType]->set_endColor(effectColor); + if (lineRenderers[intType]) { + lineRenderers[intType]->set_startColor(effectColor); + lineRenderers[intType]->set_endColor(effectColor); + } } MAKE_HOOK_MATCH(SaberBurnMarkArea_Start, &SaberBurnMarkArea::Start, void, SaberBurnMarkArea* self) { diff --git a/src/hooks/colorizer/Saber/SaberBurnMarkSparkles.cpp b/src/hooks/colorizer/Saber/SaberBurnMarkSparkles.cpp index 92f47d7..60a369b 100644 --- a/src/hooks/colorizer/Saber/SaberBurnMarkSparkles.cpp +++ b/src/hooks/colorizer/Saber/SaberBurnMarkSparkles.cpp @@ -33,8 +33,13 @@ void OnSaberColorChanged(int saberType, GlobalNamespace::SaberModelController* / Sombrero::FastColor::RGBToHSV(color, h, s, _); Sombrero::FastColor effectColor = Sombrero::FastColor::HSVToRGB(h, s, 1); - ParticleSystem::MainModule main = burnMarksPS[saberType]->get_main(); - main.set_startColor(ParticleSystem::MinMaxGradient::op_Implicit___UnityEngine__ParticleSystem_MinMaxGradient(effectColor)); + auto burnMark = burnMarksPS[saberType]; + if (!burnMark) return; + + ParticleSystem::MainModule main = burnMark->get_main(); + if (!main.m_ParticleSystem) return; + main.set_startColor( + ParticleSystem::MinMaxGradient::op_Implicit___UnityEngine__ParticleSystem_MinMaxGradient(effectColor)); } MAKE_HOOK_MATCH(SaberBurnMarkSparkles_Start, &SaberBurnMarkSparkles::Start, void, SaberBurnMarkSparkles* self) {