[Base] Fix edge case in UTF-8 fnfp/fbp.
[Base] Fix edge case in UTF-8 find_name_from_path/find_base_path with strings that consist of only a separator.
This commit is contained in:
parent
f868a10649
commit
de3825274e
|
@ -560,6 +560,9 @@ std::string find_name_from_path(const std::string_view path,
|
|||
// path is padded with separator
|
||||
size_t padding = 0;
|
||||
if (*it == uint32_t(separator)) {
|
||||
if (it == begin) {
|
||||
return std::string();
|
||||
}
|
||||
--it;
|
||||
--end;
|
||||
padding = 1;
|
||||
|
@ -626,7 +629,11 @@ std::string find_base_path(const std::string_view path, char32_t separator) {
|
|||
auto it = end;
|
||||
--it;
|
||||
|
||||
// skip trailing separator
|
||||
if (*it == uint32_t(separator)) {
|
||||
if (it == begin) {
|
||||
return std::string();
|
||||
}
|
||||
--it;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue