diff options
author | eschnett <eschnett@83718e91-0e4f-0410-abf4-91180603181f> | 2011-03-18 15:56:31 +0000 |
---|---|---|
committer | eschnett <eschnett@83718e91-0e4f-0410-abf4-91180603181f> | 2011-03-18 15:56:31 +0000 |
commit | 4e1d2fa0dfa0d5df710ac4102815ae3abbb5e70e (patch) | |
tree | fa573da67a022330b11879e259517400556691c6 | |
parent | 45cd36d843be959ccf5996c71510a5d9bd09a334 (diff) |
Avoid crash when the parameter file name has no suffix.
Avoid crash when the environment variable USER is not set.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/Formaline/trunk@202 83718e91-0e4f-0410-abf4-91180603181f
-rw-r--r-- | src/id.cc | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -127,7 +127,9 @@ namespace Formaline parfilename.erase (0, last_slash + 1); } size_t const first_dot = parfilename.find ('.'); - parfilename.erase (first_dot); + if (first_dot < string::npos) { + parfilename.erase (first_dot); + } { string::iterator it = parfilename.begin(); while (it != parfilename.end()) { @@ -154,7 +156,10 @@ namespace Formaline #if 0 char const * const run_user = CCTK_RunUser(); #else - char const * const run_user = getenv ("USER"); + char const * run_user = getenv ("USER"); + if (not run_user) { + run_user = ""; + } #endif run_idbuf << run_user; |