aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2015-02-08 16:56:43 +0100
committerjackpoz <giacomopoz@gmail.com>2015-02-08 17:07:10 +0100
commit4ba22c5eafdad2094b553c206c1dc1f30448d049 (patch)
tree053ea28a670e5a08dcab81013a531e3f3e3d6ff7 /src
parent52125216ce3c53333c06ac8cb6f7369dadce47d0 (diff)
Tools/MapExtractor: Fix crash when passing an invalid input path
Fix unhandled exception happening when passing an invalid path as -i argument.
Diffstat (limited to 'src')
-rw-r--r--src/tools/map_extractor/System.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp
index 72af10067b4..ab9774a3038 100644
--- a/src/tools/map_extractor/System.cpp
+++ b/src/tools/map_extractor/System.cpp
@@ -1185,14 +1185,22 @@ void ExtractDBFilesClient(int l)
bool OpenCascStorage()
{
- boost::filesystem::path const storage_dir (boost::filesystem::canonical (input_path) / "Data");
- if (!CascOpenStorage(storage_dir.string().c_str(), 0, &CascStorage))
+ try
{
- printf("error opening casc storage '%s': %s\n", storage_dir.string().c_str(), HumanReadableCASCError(GetLastError()));
+ boost::filesystem::path const storage_dir(boost::filesystem::canonical(input_path) / "Data");
+ if (!CascOpenStorage(storage_dir.string().c_str(), 0, &CascStorage))
+ {
+ printf("error opening casc storage '%s': %s\n", storage_dir.string().c_str(), HumanReadableCASCError(GetLastError()));
+ return false;
+ }
+ printf("opened casc storage '%s'\n", storage_dir.string().c_str());
+ return true;
+ }
+ catch (boost::filesystem::filesystem_error& error)
+ {
+ printf("error opening casc storage : %s\n", error.what());
return false;
}
- printf("opened casc storage '%s'\n", storage_dir.string().c_str());
- return true;
}
int main(int argc, char * arg[])