diff --git a/lib/src/widgets/editor.dart b/lib/src/widgets/editor.dart index 48524ca14..c67e2e8a5 100644 --- a/lib/src/widgets/editor.dart +++ b/lib/src/widgets/editor.dart @@ -1192,7 +1192,11 @@ class RenderEditableContainerBox extends RenderBox if (targetChild.getContainer() == targetNode) { break; } - targetChild = childAfter(targetChild); + final newChild = childAfter(targetChild); + if (newChild == null) { + break; + } + targetChild = newChild; } if (targetChild == null) { throw 'targetChild should not be null';