mirror of https://github.com/sean-m/McRule.git
Nullchecks added. Pruned some whitespace.
parent
a97a58e094
commit
d469df010c
|
@ -50,10 +50,10 @@ namespace McRule {
|
|||
Property = input.Item2;
|
||||
Value = input.Item3;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns an expression tree targeting an object type based on policy parameters.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public Expression<Func<T, bool>>? GetPredicateExpression<T>() {
|
||||
if (!(typeof(T).Name.Equals(this.TargetType, StringComparison.CurrentCultureIgnoreCase))) return null;
|
||||
|
||||
|
@ -66,7 +66,7 @@ namespace McRule {
|
|||
|
||||
/// <summary>
|
||||
/// Returns an expression tree targeting an object type based on policy parameters.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public Expression<Func<T, bool>>? GeneratePredicateExpression<T>(ExpressionGenerator generator) {
|
||||
if (!(typeof(T).Name.Equals(this.TargetType, StringComparison.CurrentCultureIgnoreCase))) return null;
|
||||
|
||||
|
|
|
@ -410,7 +410,7 @@ public abstract class ExpressionGeneratorBase : ExpressionGenerator
|
|||
}
|
||||
|
||||
// The value may have the right type and should just be returned.
|
||||
if (comparison is Expression<Func<T, bool>> result) {
|
||||
if (comparison is Expression<Func<T, bool>> result && result != default(Expression<Func<T, bool>>)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue