Mercurial > hg > orthanc
diff OrthancServer/main.cpp @ 2295:5465cab476cf
Fix issue #45 (crash when providing a folder to "--config" command-line option)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 05 Jul 2017 12:26:31 +0200 |
parents | ce5c13b95dac |
children | 03982a0db696 |
line wrap: on
line diff
--- a/OrthancServer/main.cpp Tue Jul 04 15:36:19 2017 +0000 +++ b/OrthancServer/main.cpp Wed Jul 05 12:26:31 2017 +0200 @@ -1207,8 +1207,17 @@ #endif std::string target = argument.substr(9); - SystemToolbox::WriteFile(configurationSample, target); - return 0; + + try + { + SystemToolbox::WriteFile(configurationSample, target); + return 0; + } + catch (OrthancException&) + { + LOG(ERROR) << "Cannot write sample configuration as file \"" << target << "\""; + return -1; + } } else {