Skip to content

Commit 65aa9e2

Browse files
Copilotrenemadsen
andcommitted
Fix NullReferenceException in MySqlJsonParameterExpressionVisitor
Add null check for typeMapping before accessing ClrType property to prevent NullReferenceException when FindMapping returns null. Co-authored-by: renemadsen <76994+renemadsen@users.noreply.github.com>
1 parent 637f07d commit 65aa9e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/EFCore.MySql/Query/ExpressionVisitors/Internal/MySqlJsonParameterExpressionVisitor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected virtual SqlExpression VisitParameter(SqlParameterExpression sqlParamet
3737

3838
// MySQL has a real JSON datatype, and string parameters need to be converted to it.
3939
// MariaDB defines the JSON datatype just as a synonym for LONGTEXT.
40-
if (!_options.ServerVersion.Supports.JsonDataTypeEmulation)
40+
if (typeMapping is not null && !_options.ServerVersion.Supports.JsonDataTypeEmulation)
4141
{
4242
return _sqlExpressionFactory.Convert(
4343
sqlParameterExpression,

0 commit comments

Comments
 (0)