From 547a1493a9aad2fac325ae174e49f030b4ef0b5a Mon Sep 17 00:00:00 2001 From: "chenghuai.dtc" Date: Mon, 28 Feb 2022 21:38:12 +0800 Subject: [PATCH] fix: fix image load error cause crash. --- kraken/lib/src/dom/elements/img.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kraken/lib/src/dom/elements/img.dart b/kraken/lib/src/dom/elements/img.dart index 9984696b61..c4466cd6d0 100644 --- a/kraken/lib/src/dom/elements/img.dart +++ b/kraken/lib/src/dom/elements/img.dart @@ -234,6 +234,7 @@ class ImageElement extends Element { } void _onImageError(Object exception, StackTrace? stackTrace) { + print('$exception\n$stackTrace'); dispatchEvent(Event(EVENT_ERROR)); } @@ -391,6 +392,9 @@ class ImageElement extends Element { forceToRepaintBoundary = true; } + // Image may be detached when image frame loaded. + if (!isRendererAttached) return; + _attachImage(); _resizeImage(); }