aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2020-06-19 19:29:47 +0200
committerSmallJoker <mk939@ymail.com>2020-06-19 19:29:47 +0200
commit57df895cf93d79293a8b47802f9523bafcaa330f (patch)
treea564c71b88990394e198760997dea4ba3b91a8ff
parent495f7198ef8336048fd3a03a9705fe45dbd57574 (diff)
downloadminetest-57df895cf93d79293a8b47802f9523bafcaa330f.tar.gz
minetest-57df895cf93d79293a8b47802f9523bafcaa330f.tar.bz2
minetest-57df895cf93d79293a8b47802f9523bafcaa330f.zip
ParticleSpawner: Fix crash when attaching to invisible entity
-rw-r--r--src/client/content_cao.h7
-rw-r--r--src/client/particles.cpp2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/client/content_cao.h b/src/client/content_cao.h
index 699148c52..974ff9a1e 100644
--- a/src/client/content_cao.h
+++ b/src/client/content_cao.h
@@ -188,10 +188,11 @@ public:
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
diff --git a/src/client/particles.cpp b/src/client/particles.cpp
index c78a3e71a..7acd996dc 100644
--- a/src/client/particles.cpp
+++ b/src/client/particles.cpp
@@ -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;
}