Fixes an exception caused by null values in query filter builder

This commit is contained in:
Serraniel 2023-03-01 17:30:00 +01:00
parent d55b6eea02
commit 80219867df
Signed by: Serraniel
GPG key ID: 3690B4E7364525D3

View file

@ -20,7 +20,7 @@ public abstract class AttributedQueryFilterBuilder : IQueryFilterBuilder
continue; continue;
var paramName = attribute.ParamName ?? propertyInfo.Name; var paramName = attribute.ParamName ?? propertyInfo.Name;
var value = propertyInfo.GetValue(this).ToString(); var value = propertyInfo.GetValue(this)?.ToString();
if (!string.IsNullOrEmpty(value)) filterBucket.Add(new KeyValuePair<string, string>(paramName, value)); if (!string.IsNullOrEmpty(value)) filterBucket.Add(new KeyValuePair<string, string>(paramName, value));
} }