diff --git a/lib/src/models/documents/nodes/line.dart b/lib/src/models/documents/nodes/line.dart index 3e3bbb04..4b6db80f 100644 --- a/lib/src/models/documents/nodes/line.dart +++ b/lib/src/models/documents/nodes/line.dart @@ -381,7 +381,7 @@ class Line extends Container { } final remaining = len - local; - if (remaining > 0) { + if (remaining > 0 && nextLine != null) { final rest = nextLine!.collectStyle(0, remaining); _handle(rest); } @@ -416,7 +416,7 @@ class Line extends Container { // TODO: add line style and parent's block style final remaining = len - local; - if (remaining > 0) { + if (remaining > 0 && nextLine != null) { final rest = nextLine!.collectAllIndividualStyles(0, remaining, beg: local); result.addAll(rest); @@ -450,7 +450,7 @@ class Line extends Container { } final remaining = len - local; - if (remaining > 0) { + if (remaining > 0 && nextLine != null) { final rest = nextLine!.collectAllStyles(0, remaining); result.addAll(rest); } @@ -501,7 +501,7 @@ class Line extends Container { } } - if (_len > 0) { + if (_len > 0 && nextLine != null) { _len = nextLine!._getPlainText(0, _len, plainText); } }