8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 21:23:04 +01:00

Fixed case with empty path - thanks to Dmitry Kovalenko

This commit is contained in:
alexpeshkoff 2013-03-28 07:24:25 +00:00
parent 7d7fea0288
commit 78c670f7e4
2 changed files with 2 additions and 2 deletions

View File

@ -121,7 +121,7 @@ void PathUtils::splitLastComponent(Firebird::PathName& path, Firebird::PathName&
void PathUtils::splitPrefix(Firebird::PathName& path, Firebird::PathName& prefix) void PathUtils::splitPrefix(Firebird::PathName& path, Firebird::PathName& prefix)
{ {
prefix.erase(); prefix.erase();
while (path[0] == dir_sep) while (path.hasData() && path[0] == dir_sep)
{ {
prefix = dir_sep; prefix = dir_sep;
path.erase(0, 1); path.erase(0, 1);

View File

@ -167,7 +167,7 @@ void PathUtils::splitPrefix(Firebird::PathName& path, Firebird::PathName& prefix
prefix = path.substr(0, 2); prefix = path.substr(0, 2);
path.erase(0, 2); path.erase(0, 2);
} }
if (path[0] == PathUtils::dir_sep || path[0] == '/') if (path.hasData() && (path[0] == PathUtils::dir_sep || path[0] == '/'))
{ {
prefix += path[0]; prefix += path[0];
path.erase(0, 1); path.erase(0, 1);