Use int.tryParse in sourcemap_testing

Change-Id: I7e2f51628604cc7522752b7b67d3c5b6775901c2
Reviewed-on: https://dart-review.googlesource.com/54905
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Johnni Winther 2018-05-14 13:56:18 +00:00 committed by commit-bot@chromium.org
parent 37d028e17c
commit e7bae4c8fd

View file

@ -285,14 +285,12 @@ class StackTraceLine {
String fileName;
int lastColon = text.lastIndexOf(':');
if (lastColon != -1) {
int lastValue =
int.parse(text.substring(lastColon + 1), onError: (_) => null);
int lastValue = int.tryParse(text.substring(lastColon + 1));
if (lastValue != null) {
int secondToLastColon = text.lastIndexOf(':', lastColon - 1);
if (secondToLastColon != -1) {
int secondToLastValue = int.parse(
text.substring(secondToLastColon + 1, lastColon),
onError: (_) => null);
int secondToLastValue =
int.tryParse(text.substring(secondToLastColon + 1, lastColon));
if (secondToLastValue != null) {
lineNo = secondToLastValue;
columnNo = lastValue;