summaryrefslogtreecommitdiff
path: root/Source/cmDynamicLoader.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-02-17 08:35:23 -0500
committerBill Hoffman <bill.hoffman@kitware.com>2004-02-17 08:35:23 -0500
commit8f565bdc74d7d2b57c5de0f9079abf21e2c78327 (patch)
treeef39e589dc230fad22e0c4eaeb1d0bf8776b98eb /Source/cmDynamicLoader.cxx
parent5a391f8aa7168f70c7315f8a7c9e14ba435843f9 (diff)
downloadcmake-8f565bdc74d7d2b57c5de0f9079abf21e2c78327.tar.gz
BUG: don't crash when loading a module that does not exist
Diffstat (limited to 'Source/cmDynamicLoader.cxx')
-rw-r--r--Source/cmDynamicLoader.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/Source/cmDynamicLoader.cxx b/Source/cmDynamicLoader.cxx
index 14568bf1b7..e6c71b25c0 100644
--- a/Source/cmDynamicLoader.cxx
+++ b/Source/cmDynamicLoader.cxx
@@ -162,12 +162,19 @@ cmLibHandle cmDynamicLoader::OpenLibrary(const char* libname )
}
NSObjectFileImageReturnCode rc;
- NSObjectFileImage image;
+ NSObjectFileImage image = 0;
rc = NSCreateObjectFileImageFromFile(libname, &image);
+ if(!image)
+ {
+ return 0;
+ }
lh = NSLinkModule(image, libname, TRUE);
- cmDynamicLoaderCache::GetInstance()->CacheFile(libname, lh);
- return lh;
+ if(lh)
+ {
+ cmDynamicLoaderCache::GetInstance()->CacheFile(libname, lh);
+ }
+ return lh;
}
int cmDynamicLoader::CloseLibrary(cmLibHandle lib)
@@ -334,6 +341,6 @@ const char* cmDynamicLoader::LibPrefix()
const char* cmDynamicLoader::LibExtension()
{
- return CMAKE_SHARED_LIBRARY_SUFFIX;
+ return CMAKE_SHARED_MODULE_SUFFIX;
}