From 4eb2d1d9f2f8eda594da83672d9dbac0a26c9520 Mon Sep 17 00:00:00 2001 From: Egor Korshun <120365747+EgorK0rshun@users.noreply.github.com> Date: Fri, 8 Sep 2023 17:08:50 +0300 Subject: [PATCH] Fix #1392: UnhandledFlutterException: Null check operator used on a null value in Container.insert(container.dart:127) (#1393) --- CHANGELOG.md | 3 +++ lib/src/models/documents/nodes/container.dart | 16 ++++++++-------- pubspec.yaml | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43a6486d..19d7ce8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# [7.4.5] +- Fix #1392. + # [7.4.4] - Fix #1311. diff --git a/lib/src/models/documents/nodes/container.dart b/lib/src/models/documents/nodes/container.dart index 306d56bc..c8cd3a59 100644 --- a/lib/src/models/documents/nodes/container.dart +++ b/lib/src/models/documents/nodes/container.dart @@ -124,15 +124,15 @@ abstract class Container extends Node { if (isNotEmpty) { final child = queryChild(index, false); - child.node!.insert(child.offset, data, style); - return; + if (child.isNotEmpty) { + child.node!.insert(child.offset, data, style); + } + } else { + assert(index == 0); + final node = defaultChild; + add(node); + node?.insert(index, data, style); } - - // empty - assert(index == 0); - final node = defaultChild; - add(node); - node?.insert(index, data, style); } @override diff --git a/pubspec.yaml b/pubspec.yaml index 4509d2d1..10a3e647 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill description: A rich text editor built for the modern Android, iOS, web and desktop platforms. It is the WYSIWYG editor and a Quill component for Flutter. -version: 7.4.4 +version: 7.4.5 homepage: https://1o24bbs.com/c/bulletjournal/108 repository: https://github.com/singerdmx/flutter-quill