From a847925ca417d4fc88b59132dd3d312db2752073 Mon Sep 17 00:00:00 2001 From: Gary Roumanis Date: Thu, 18 Jul 2019 12:38:15 -0700 Subject: [PATCH] Handle null coverage range --- CHANGELOG.md | 4 ++++ lib/src/collect.dart | 3 +++ pubspec.yaml | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae85ed47..af4b5ca7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.13.1 - 2019-07-18 + + * Handle scenario where the VM returns empty coverage information for a range. + ## 0.13.0 - 2019-07-10 * BREAKING CHANGE: Skips collecting coverage for `dart:` libaries by default, diff --git a/lib/src/collect.dart b/lib/src/collect.dart index cc8ec42b..e1d248ec 100644 --- a/lib/src/collect.dart +++ b/lib/src/collect.dart @@ -164,6 +164,9 @@ Future>> _getCoverageJson(VmService service, // Collect hits and misses. final coverage = range.coverage; + + if (coverage == null) continue; + for (final tokenPos in coverage.hits) { final line = _getLineFromTokenPos(script, tokenPos); if (line == null) { diff --git a/pubspec.yaml b/pubspec.yaml index 3b87e2fc..86f10cbd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: coverage -version: 0.13.0 +version: 0.13.1 author: Dart Team description: Coverage data manipulation and formatting homepage: https://github.com/dart-lang/coverage