From 3fd801b4a186255cd68d8b3188a75210197a905c Mon Sep 17 00:00:00 2001 From: Vishesh Handa Date: Wed, 29 May 2019 17:34:47 +0200 Subject: [PATCH] Fix "Value not in range: -1" error Fixes #4 --- lib/utils/markdown.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/utils/markdown.dart b/lib/utils/markdown.dart index 124e9d3b..7c18ed3e 100644 --- a/lib/utils/markdown.dart +++ b/lib/utils/markdown.dart @@ -25,7 +25,10 @@ class MarkdownBuilder implements md.NodeVisitor { }); var str = stringBuffer.toString(); - return str.substring(0, str.length - 1); + if (str.isNotEmpty) { + return str.substring(0, str.length - 1); + } + return str; } @override