From 8e17339ef08d9972de2cd76232b906136ff9a42d Mon Sep 17 00:00:00 2001 From: Thomas Fussell Date: Thu, 14 Jul 2016 07:20:31 +0800 Subject: [PATCH] fix out of bounds error detected in msvc --- source/detail/number_formatter.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/detail/number_formatter.cpp b/source/detail/number_formatter.cpp index 720493f9..c2ff03e6 100644 --- a/source/detail/number_formatter.cpp +++ b/source/detail/number_formatter.cpp @@ -647,17 +647,17 @@ number_format_token number_format_parser::parse_next_token() switch (current_char) { case '[': - do - { - token.string.push_back(format_string_[position_++]); - } - while (format_string_[position_] != ']' && position_ < format_string_.size()); - if (position_ == format_string_.size()) { throw std::runtime_error("missing ]"); } + do + { + token.string.push_back(format_string_[position_++]); + } + while (position_ < format_string_.size() && format_string_[position_] != ']'); + if (token.string.empty()) { throw std::runtime_error("empty []");