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

Unified Diff: lib/src/chain.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 | « CHANGELOG.md ('k') | lib/src/trace.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/chain.dart
diff --git a/lib/src/chain.dart b/lib/src/chain.dart
index 87cc6be99336c8a6535d575074e63a3dc5c8c1c0..3e2100e46340544d87c1e1c1753f892cdda50596 100644
--- a/lib/src/chain.dart
+++ b/lib/src/chain.dart
@@ -127,8 +127,11 @@ class Chain implements StackTrace {
/// Parses a string representation of a stack chain.
///
/// Specifically, this parses the output of [Chain.toString].
- factory Chain.parse(String chain) =>
- new Chain(chain.split(_gap).map((trace) => new Trace.parseFriendly(trace)));
+ factory Chain.parse(String chain) {
+ if (chain.isEmpty) return new Chain([]);
+ return new Chain(
+ chain.split(_gap).map((trace) => new Trace.parseFriendly(trace)));
+ }
/// Returns a new [Chain] comprised of [traces].
Chain(Iterable<Trace> traces)
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/trace.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698