diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index 79182cb2b86..6cdf5f8cd18 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -419,5 +419,7 @@ Particles2D::Particles2D() { } Particles2D::~Particles2D() { - VS::get_singleton()->free(particles); + if (particles.is_valid()) { + VS::get_singleton()->free(particles); + } } diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index f70d308cb34..df5f6de21b2 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -179,7 +179,9 @@ GIProbeData::GIProbeData() { } GIProbeData::~GIProbeData() { - VS::get_singleton()->free(probe); + if (probe.is_valid()) { + VS::get_singleton()->free(probe); + } } ////////////////////// @@ -527,5 +529,7 @@ GIProbe::GIProbe() { } GIProbe::~GIProbe() { - VS::get_singleton()->free(gi_probe); + if (gi_probe.is_valid()) { + VS::get_singleton()->free(gi_probe); + } } diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index 4076aa27527..26c40e0677d 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -416,5 +416,7 @@ Particles::Particles() { } Particles::~Particles() { - VS::get_singleton()->free(particles); + if (particles.is_valid()) { + VS::get_singleton()->free(particles); + } }