Browse Source

Do not create invalid module references when querying the manager.

Sascha Zelzer 12 years ago
parent
commit
cd9f093fe5
1 changed files with 2 additions and 1 deletions
  1. 2 1
      Libs/CommandLineModules/Core/ctkCmdLineModuleManager.cpp

+ 2 - 1
Libs/CommandLineModules/Core/ctkCmdLineModuleManager.cpp

@@ -266,7 +266,8 @@ void ctkCmdLineModuleManager::unregisterModule(const ctkCmdLineModuleReference&
 ctkCmdLineModuleReference ctkCmdLineModuleManager::moduleReference(const QUrl &location) const
 {
   QMutexLocker lock(&d->Mutex);
-  return d->LocationToRef[location];
+  QHash<QUrl, ctkCmdLineModuleReference>::const_iterator iter = d->LocationToRef.find(location);
+  return (iter == d->LocationToRef.end()) ? ctkCmdLineModuleReference() : iter.value();
 }
 
 //----------------------------------------------------------------------------