Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1002)

Unified Diff: lib/src/trace.dart

Issue 1171873002: Support parsing empty stack chains. (Closed) Base URL: git@github.com:dart-lang/stack_trace@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/chain.dart ('k') | test/chain_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/trace.dart
diff --git a/lib/src/trace.dart b/lib/src/trace.dart
index 2fce0c7c3d51aa64dc5f1a1eef025d4586b642fd..ce5ec50fe174c00f7916d21b494e547f1154b429 100644
--- a/lib/src/trace.dart
+++ b/lib/src/trace.dart
@@ -188,10 +188,12 @@ class Trace implements StackTrace {
/// This also parses string representations of [Chain]s. They parse to the
/// same trace that [Chain.toTrace] would return.
Trace.parseFriendly(String trace)
- : this(trace.trim().split("\n")
- // Filter out asynchronous gaps from [Chain]s.
- .where((line) => !line.startsWith('====='))
- .map((line) => new Frame.parseFriendly(line)));
+ : this(trace.isEmpty
+ ? []
+ : trace.trim().split("\n")
+ // Filter out asynchronous gaps from [Chain]s.
+ .where((line) => !line.startsWith('====='))
+ .map((line) => new Frame.parseFriendly(line)));
/// Returns a new [Trace] comprised of [frames].
Trace(Iterable<Frame> frames)
« no previous file with comments | « lib/src/chain.dart ('k') | test/chain_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698