diff --git a/src/file.cpp b/src/file.cpp index 4d5d7da74..7931255ad 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -575,7 +575,7 @@ namespace libtorrent int i = 0; // match the xx:\ or xx:/ form while (f[i] && is_alpha(f[i])) ++i; - if (i < int(f.size()-2) && f[i] == ':' && (f[i+1] == '\\' || f[i+1] == '/')) + if (i < int(f.size()-1) && f[i] == ':' && (f[i+1] == '\\' || f[i+1] == '/')) return true; // match the \\ form diff --git a/test/test_primitives.cpp b/test/test_primitives.cpp index 4f384adf5..b6004b32c 100644 --- a/test/test_primitives.cpp +++ b/test/test_primitives.cpp @@ -543,6 +543,7 @@ int test_main() #endif #ifdef TORRENT_WINDOWS + TEST_EQUAL(is_complete("c:\\"), true); TEST_EQUAL(is_complete("c:\\foo\\bar"), true); TEST_EQUAL(is_complete("\\\\foo\\bar"), true); TEST_EQUAL(is_complete("foo/bar"), false);