Permalink
Browse files

Preventing a null reference exception from happening when something i…

…s null in an object graph we're evaluating. Working on fixing this for real now.
  • Loading branch information...
bbehrens committed Mar 21, 2012
1 parent 3d2cd87 commit 990eac0f8b95aeb030ca3d79eab31777a3a069fa
Showing with 11 additions and 1 deletion.
  1. +11 −1 src/FubuFastPack/Querying/SingleEntityFilter.cs
@@ -58,7 +58,17 @@ public void Or(Action<IOrOptions<T>>[] orOperations)
orOperation(orOptions);
}
var compile = orOptions.BuildOut().Compile();
- setCanView(compile.Invoke(_domainEntity));
+ var canView = false;
+
+ try
+ {
+ canView = compile.Invoke(_domainEntity);
+ }
+ catch (NullReferenceException) { }
+ finally
+ {
+ setCanView(canView);
+ }
}
public void ApplyRestriction(IDataRestriction<T> restriction)

0 comments on commit 990eac0

Please sign in to comment.