Skip to content

Commit 59bea50

Browse files
authored
🐛 Avoid potential null operations when saving the entity (#288)
1 parent 9fa4e14 commit 59bea50

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ See the [Migration Guide](guides/migration_guide.md) for breaking changes betwee
2929
### Fixes
3030

3131
- Fix preview file delete predication.
32+
- Avoid potential null operations when saving the entity.
3233

3334
## 4.3.3
3435

lib/src/states/camera_picker_state.dart

+9-5
Original file line numberDiff line numberDiff line change
@@ -966,15 +966,19 @@ class CameraPickerState extends State<CameraPicker>
966966
}
967967
wrapControllerMethod<void>(
968968
'setFocusMode',
969-
() => controller.setFocusMode(FocusMode.auto),
969+
() async {
970+
await innerController?.setFocusMode(FocusMode.auto);
971+
},
970972
);
971973
if (previousExposureMode != ExposureMode.locked) {
972974
wrapControllerMethod<void>(
973975
'setExposureMode',
974-
() => controller.setExposureMode(previousExposureMode),
976+
() async {
977+
await innerController?.setExposureMode(previousExposureMode);
978+
},
975979
);
976980
}
977-
await controller.resumePreview();
981+
await innerController?.resumePreview();
978982
} catch (e, s) {
979983
handleErrorWithHandler(e, s, pickerConfig.onError);
980984
} finally {
@@ -1092,13 +1096,13 @@ class CameraPickerState extends State<CameraPicker>
10921096
);
10931097
if (entity != null) {
10941098
if (pickerConfig.onPickConfirmed case final onPickConfirmed?) {
1095-
await controller.resumePreview();
1099+
await innerController?.resumePreview();
10961100
onPickConfirmed(entity);
10971101
} else {
10981102
Navigator.of(context).pop(entity);
10991103
}
11001104
} else {
1101-
await controller.resumePreview();
1105+
await innerController?.resumePreview();
11021106
}
11031107
} catch (e, s) {
11041108
recordCountdownTimer?.cancel();

0 commit comments

Comments
 (0)