Skip to content

Commit 57df895

Browse files
committedJun 19, 2020
ParticleSpawner: Fix crash when attaching to invisible entity
1 parent 495f719 commit 57df895

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed
 

‎src/client/content_cao.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,11 @@ class GenericCAO : public ClientActiveObject
188188
return m_matrixnode->getRelativeTransformationMatrix();
189189
}
190190

191-
inline const core::matrix4 &getAbsolutePosRotMatrix() const
191+
inline const core::matrix4 *getAbsolutePosRotMatrix() const
192192
{
193-
assert(m_matrixnode);
194-
return m_matrixnode->getAbsoluteTransformation();
193+
if (!m_matrixnode)
194+
return nullptr;
195+
return &m_matrixnode->getAbsoluteTransformation();
195196
}
196197

197198
inline f32 getStepHeight() const

‎src/client/particles.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ void ParticleSpawner::step(float dtime, ClientEnvironment *env)
349349
const core::matrix4 *attached_absolute_pos_rot_matrix = nullptr;
350350
if (m_attached_id) {
351351
if (GenericCAO *attached = dynamic_cast<GenericCAO *>(env->getActiveObject(m_attached_id))) {
352-
attached_absolute_pos_rot_matrix = &attached->getAbsolutePosRotMatrix();
352+
attached_absolute_pos_rot_matrix = attached->getAbsolutePosRotMatrix();
353353
} else {
354354
unloaded = true;
355355
}

0 commit comments

Comments
 (0)
Please sign in to comment.