Skip to content

Commit 8913cc9

Browse files
committed
Fix null ref error if model type is object
1 parent 993314c commit 8913cc9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Source/Blade/BasePresenterFactory.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ public IPresenter<TModel> GetPresenter<TModel>()
5656
protected virtual IPresenter<TModel> ResolvePresenter<TModel>()
5757
where TModel : class
5858
{
59+
if(typeof(TModel) == typeof(object))
60+
throw new ArgumentException("Model type cannot be object (or dynamic) because that would match any presenter (any type can be assigned to object).");
61+
5962
Type presenterInterfaceType = typeof(IPresenter<TModel>);
6063
Type presenterType;
6164

0 commit comments

Comments
 (0)