Skip to content
Permalink
Browse files

ParticleSpawner: Fix crash when attaching to invisible entity

  • Loading branch information
SmallJoker committed Jun 19, 2020
1 parent 495f719 commit 57df895cf93d79293a8b47802f9523bafcaa330f
Showing with 5 additions and 4 deletions.
  1. +4 −3 src/client/content_cao.h
  2. +1 −1 src/client/particles.cpp
@@ -188,10 +188,11 @@ class GenericCAO : public ClientActiveObject
return m_matrixnode->getRelativeTransformationMatrix();
}

inline const core::matrix4 &getAbsolutePosRotMatrix() const
inline const core::matrix4 *getAbsolutePosRotMatrix() const
{
assert(m_matrixnode);
return m_matrixnode->getAbsoluteTransformation();
if (!m_matrixnode)
return nullptr;
return &m_matrixnode->getAbsoluteTransformation();
}

inline f32 getStepHeight() const
@@ -349,7 +349,7 @@ void ParticleSpawner::step(float dtime, ClientEnvironment *env)
const core::matrix4 *attached_absolute_pos_rot_matrix = nullptr;
if (m_attached_id) {
if (GenericCAO *attached = dynamic_cast<GenericCAO *>(env->getActiveObject(m_attached_id))) {
attached_absolute_pos_rot_matrix = &attached->getAbsolutePosRotMatrix();
attached_absolute_pos_rot_matrix = attached->getAbsolutePosRotMatrix();
} else {
unloaded = true;
}

0 comments on commit 57df895

Please sign in to comment.
You can’t perform that action at this time.