diff --git a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs index 1c62fba95..a6ae46b3f 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/SqlBuilderProvider/QueryBuilder.cs @@ -490,7 +490,7 @@ namespace SqlSugar it.TableName.Equals(entityInfo.EntityName, StringComparison.CurrentCultureIgnoreCase)); if (easyInfo == null) { - if (ChildType.IsInterface && JoinQueryInfos.Any(it => it.EntityType.GetInterfaces().Any(z => z == ChildType))) + if (ChildType.IsInterface && JoinQueryInfos.Any(it =>it.EntityType!=null&&it.EntityType.GetInterfaces().Any(z => z == ChildType))) { easyInfo = JoinQueryInfos.FirstOrDefault(it => it.EntityType.GetInterfaces().Any(z => z == ChildType)); }