feat: check line_num before converting it to int

This commit is contained in:
ToruNiina 2019-10-31 22:21:24 +09:00
parent 8e589ff4d7
commit 3ca712a8da

View File

@ -48,7 +48,11 @@ struct source_location
{
if(reg)
{
line_num_ = static_cast<std::uint_least32_t>(std::stoul(reg->line_num()));
if(reg->line_num() != detail::region_base().line_num())
{
line_num_ = static_cast<std::uint_least32_t>(
std::stoul(reg->line_num()));
}
column_num_ = static_cast<std::uint_least32_t>(reg->before() + 1);
region_size_ = static_cast<std::uint_least32_t>(reg->size());
file_name_ = reg->name();