From 9bb85dfe46d31f6aae8c0a131a7d0c72dd1b912e Mon Sep 17 00:00:00 2001 From: David <51410049+davidhsoftware@users.noreply.github.com> Date: Mon, 15 Aug 2022 13:20:38 +1000 Subject: [PATCH] Prevent additional checks from failing if nullable value is null --- .../lib/src/runtime/query_builder/schema/column_impl.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drift/lib/src/runtime/query_builder/schema/column_impl.dart b/drift/lib/src/runtime/query_builder/schema/column_impl.dart index 18984cf9..8569343d 100644 --- a/drift/lib/src/runtime/query_builder/schema/column_impl.dart +++ b/drift/lib/src/runtime/query_builder/schema/column_impl.dart @@ -190,10 +190,11 @@ class GeneratedColumn extends Column { final nullOk = $nullable; if (!nullOk && value == null) { return _invalidNull; + } else if (nullOk && value == null) { + return const VerificationResult.success(); } else { - // ignore: null_check_on_nullable_type_parameter - return additionalChecks?.call(value!, meta) ?? - const VerificationResult.success(); + // ignore: null_check_on_nullable_type_parameter + return additionalChecks?.call(value!, meta) ?? const VerificationResult.success(); } }