summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/ftp/ftp_util.cc2
-rw-r--r--net/ftp/ftp_util_unittest.cc1
2 files changed, 2 insertions, 1 deletions
diff --git a/net/ftp/ftp_util.cc b/net/ftp/ftp_util.cc
index ff9aaa9..79e6b71 100644
--- a/net/ftp/ftp_util.cc
+++ b/net/ftp/ftp_util.cc
@@ -100,7 +100,7 @@ std::string FtpUtil::VMSPathToUnix(const std::string& vms_path) {
std::replace(result.begin(), result.end(), ']', '/');
// Make sure the result doesn't end with a slash.
- if (result[result.length() - 1] == '/')
+ if (result.length() && result[result.length() - 1] == '/')
result = result.substr(0, result.length() - 1);
return result;
diff --git a/net/ftp/ftp_util_unittest.cc b/net/ftp/ftp_util_unittest.cc
index 480c893..20450c2 100644
--- a/net/ftp/ftp_util_unittest.cc
+++ b/net/ftp/ftp_util_unittest.cc
@@ -94,6 +94,7 @@ TEST(FtpUtilTest, VMSPathToUnix) {
{ "[.a.b.c]", "a/b/c" },
{ "[.a.b.c]d", "a/b/c/d" },
{ "[.a.b.c.d]", "a/b/c/d" },
+ { "[.", "" },
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) {
EXPECT_EQ(kTestCases[i].expected_output,