Browse Source

Detect attempt to copy a base class's attributes onto itself, and early-exit in that case.

Lasse Öörni 10 years ago
parent
commit
77e6703b15
1 changed files with 4 additions and 0 deletions
  1. 4 0
      Source/Urho3D/Core/Context.cpp

+ 4 - 0
Source/Urho3D/Core/Context.cpp

@@ -164,6 +164,10 @@ VariantMap& Context::GetEventDataMap()
 
 void Context::CopyBaseAttributes(StringHash baseType, StringHash derivedType)
 {
+    // Prevent endless loop if mistakenly copying attributes from same class as derived
+    if (baseType == derivedType)
+        return;
+
     const Vector<AttributeInfo>* baseAttributes = GetAttributes(baseType);
     if (baseAttributes)
     {