فهرست منبع

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

Lasse Öörni 10 سال پیش
والد
کامیت
77e6703b15
1فایلهای تغییر یافته به همراه4 افزوده شده و 0 حذف شده
  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)
 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);
     const Vector<AttributeInfo>* baseAttributes = GetAttributes(baseType);
     if (baseAttributes)
     if (baseAttributes)
     {
     {