From 3ca712a8dada865de3755d64e2cf22bf2f982fe0 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Thu, 31 Oct 2019 22:21:24 +0900 Subject: [PATCH] feat: check line_num before converting it to int --- toml/source_location.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/toml/source_location.hpp b/toml/source_location.hpp index 051f4e5..f85c51e 100644 --- a/toml/source_location.hpp +++ b/toml/source_location.hpp @@ -48,7 +48,11 @@ struct source_location { if(reg) { - line_num_ = static_cast(std::stoul(reg->line_num())); + if(reg->line_num() != detail::region_base().line_num()) + { + line_num_ = static_cast( + std::stoul(reg->line_num())); + } column_num_ = static_cast(reg->before() + 1); region_size_ = static_cast(reg->size()); file_name_ = reg->name();