Navaron Bracke

skip update scan window if disposed or not ready

@@ -292,6 +292,10 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> { @@ -292,6 +292,10 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
292 /// 292 ///
293 /// If [window] is null, the scan window will be reset to the full camera preview. 293 /// If [window] is null, the scan window will be reset to the full camera preview.
294 Future<void> updateScanWindow(Rect? window) async { 294 Future<void> updateScanWindow(Rect? window) async {
  295 + if (_isDisposed || !value.isInitialized) {
  296 + return;
  297 + }
  298 +
295 await MobileScannerPlatform.instance.updateScanWindow(window); 299 await MobileScannerPlatform.instance.updateScanWindow(window);
296 } 300 }
297 301