Ver Fonte

Don't throw exception when loading module in thread.

The module registry throws an exception when trying to register a module
instances if an instance is already registered under the same name. This
backfired in love.thread when requiring love-modules.
vrld há 13 anos atrás
pai
commit
e9dcc16f16
1 ficheiros alterados com 5 adições e 0 exclusões
  1. 5 0
      src/common/Module.cpp

+ 5 - 0
src/common/Module.cpp

@@ -42,8 +42,13 @@ namespace love
 		std::string name(instance->getName());
 
 		std::map<std::string, Module*>::iterator it = registry.find(name);
+
 		if (registry.end() != it)
+		{
+			if (it->second == instance)
+				return;
 			throw Exception("Module %s already registered!", instance->getName());
+		}
 
 		registry.insert(make_pair(name, instance));
 	}