Skip to content

Commit f98ba9d

Browse files
committed
To prevent getting "object reference not set to an instance of an object" error when value of some properties in DbEntity are null or empty string.
1 parent bc53579 commit f98ba9d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/jQueryDatatableServerSideNetCore22/Extensions/LinqExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static IQueryable<T> WhereDynamic<T>(
4040

4141
//Expression
4242
sourceList = sourceList.Where(c =>
43-
properties.Any(p => p.GetValue(c).ToString()
43+
properties.Any(p => p.GetValue(c) != null && p.GetValue(c).ToString()
4444
.Contains(query, StringComparison.InvariantCultureIgnoreCase)));
4545
}
4646
catch (Exception e)

0 commit comments

Comments
 (0)