diff --git a/FreeSql/Internal/CommonProvider/SelectProvider/Select1Provider.cs b/FreeSql/Internal/CommonProvider/SelectProvider/Select1Provider.cs index 99fd0dc27..a06685c5d 100644 --- a/FreeSql/Internal/CommonProvider/SelectProvider/Select1Provider.cs +++ b/FreeSql/Internal/CommonProvider/SelectProvider/Select1Provider.cs @@ -213,6 +213,8 @@ public ISelect FromQuery(ISelect select2 public ISelect UnionAll(params ISelect[] querys) { + querys = querys?.Where(q => q != null).ToArray(); + if (querys?.Any() != true) return this; var ret = (_orm as BaseDbProvider).CreateSelectProvider(null) as Select1Provider; var sb = new StringBuilder().Append(LocalGetQuerySql(this)); foreach (var select2 in querys)