Unverified Commit 4991c4bb authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

bugfix: check empty string on has_trailing_slash

since back() has undefined behaviour on empty string we need to ensure
that the string is not empty before to check the last char.
parent 729c4e29
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ bool is_absolute_path(const std::string& path) {
}

bool has_trailing_slash(const std::string& path) {
    return path.back() == PSP;
    return (!path.empty()) && (path.back() == PSP);
}

/* Add path prefix to a given C string.