mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-09-18 18:27:55 +08:00
handle tokenizing invalid numeric string correctly
rather than throwing when an invalid numeric string is read, our tokenizer now returns false so that error recovery methods can be attempted.
This commit is contained in:
@@ -96,7 +96,11 @@
|
||||
token = NumericToken.OneThousand;
|
||||
return true;
|
||||
default:
|
||||
var value = decimal.Parse(str, NumberStyles.Any, CultureInfo.InvariantCulture);
|
||||
if (!decimal.TryParse(str, NumberStyles.Any, CultureInfo.InvariantCulture, out var value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
token = new NumericToken(value);
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user