summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities/Entity.cpp')
-rw-r--r--src/Entities/Entity.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index fbf76e008..bc66305b1 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -1107,9 +1107,11 @@ void cEntity::AttachTo(cEntity * a_AttachTo)
// Already attached to that entity, nothing to do here
return;
}
-
- // Detach from any previous entity:
- Detach();
+ if (m_AttachedTo != NULL)
+ {
+ // Detach from any previous entity:
+ Detach();
+ }
// Attach to the new entity:
m_AttachedTo = a_AttachTo;