corefile.cpp: Make core_filename_extract_base behave more robustly in degenerate cases

This commit is contained in:
AJR 2021-03-05 11:32:37 -05:00
parent 05da482144
commit ad3fa37944

View File

@ -1260,6 +1260,8 @@ std::string_view core_filename_extract_base(std::string_view name, bool strip_ex
{
// find the start of the basename
auto const start = std::find_if(name.rbegin(), name.rend(), &util::is_directory_separator);
if (start == name.rbegin())
return std::string_view();
// find the end of the basename
auto const chop_position = strip_extension