diff --git a/src/FbTk/StringUtil.cc b/src/FbTk/StringUtil.cc index 0a7ebd31..f76a1f9f 100644 --- a/src/FbTk/StringUtil.cc +++ b/src/FbTk/StringUtil.cc @@ -176,7 +176,7 @@ string expandFilename(const string &filename) { size_t pos = filename.find_first_not_of(" \t"); if (pos != string::npos && filename[pos] == '~') { retval = getenv("HOME"); - if (pos != filename.size()) { + if (pos + 1 < filename.size()) { // copy from the character after '~' retval += static_cast(filename.c_str() + pos + 1); }