mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-18 10:28:09 +08:00
fix: check if it is empty before calling back()
This commit is contained in:
@@ -344,7 +344,7 @@ struct region final : public region_base
|
|||||||
{
|
{
|
||||||
// unwrap the first '#' by std::next.
|
// unwrap the first '#' by std::next.
|
||||||
auto str = make_string(std::next(comment_found), iter);
|
auto str = make_string(std::next(comment_found), iter);
|
||||||
if(str.back() == '\r') {str.pop_back();}
|
if(!str.empty() && str.back() == '\r') {str.pop_back();}
|
||||||
com.push_back(std::move(str));
|
com.push_back(std::move(str));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -397,7 +397,7 @@ struct region final : public region_base
|
|||||||
{
|
{
|
||||||
// unwrap the first '#' by std::next.
|
// unwrap the first '#' by std::next.
|
||||||
auto str = make_string(std::next(comment_found), this->line_end());
|
auto str = make_string(std::next(comment_found), this->line_end());
|
||||||
if(str.back() == '\r') {str.pop_back();}
|
if(!str.empty() && str.back() == '\r') {str.pop_back();}
|
||||||
com.push_back(std::move(str));
|
com.push_back(std::move(str));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user