diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/StringToNumberConverter.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/common/StringToNumberConverter.cpp b/src/common/StringToNumberConverter.cpp index 259e39b0..d77f7886 100644 --- a/src/common/StringToNumberConverter.cpp +++ b/src/common/StringToNumberConverter.cpp @@ -143,10 +143,21 @@ StringToIntegerConverterImplResult StringToIntegerConverterImpl::Parse( while (current != end && IsSpace(*current)) { current++; } + + if (current != end) { + if (processed_characters_count) { + *processed_characters_count = 0; + } + if (throw_on_error) { + throw Exception(u"There is trailing junk."); + } else { + return {false, 0}; + } + } } - if (current != end) { - throw Exception(u"There is trailing junk."); + if (processed_characters_count) { + *processed_characters_count = current - str; } return {negate, result}; |