Merge pull request #133 from victorlevasseur/bugfix/platform-invalid-objects

Fix Project::CreateObject not properly creating objects when multiple platforms are available
This commit is contained in:
Florian Rival
2015-06-08 22:03:15 +12:00

View File

@@ -109,8 +109,8 @@ std::shared_ptr<gd::Object> Project::CreateObject(const std::string & type, cons
{
if ( !platformName.empty() && platforms[i]->GetName() != platformName ) continue;
std::shared_ptr<gd::Object> object = platforms[i]->CreateObject(type, name);
if ( object ) return object;
std::shared_ptr<gd::Object> object = platforms[i]->CreateObject(type, name); //Create a base object if the type can't be found in the platform
if ( object && object->GetType() == type ) return object; //If the object is valid and has the good type (not a base object), return it
}
return std::shared_ptr<gd::Object>();