Browse Source

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 13 years ago
parent
commit
e9dcc16f16
1 changed files with 5 additions and 0 deletions
  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));
 	}