Skip to content

Commit

Permalink
check that AssociatedObject is set before Execute() is called
Browse files Browse the repository at this point in the history
  • Loading branch information
tibel committed Jun 1, 2014
1 parent dd277df commit 8a35356
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Caliburn.Xaml.Universal/Behaviors/TriggerAction.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Xaml.Interactivity;
using System;
using Microsoft.Xaml.Interactivity;
using Windows.UI.Xaml;

namespace Caliburn.Light
Expand Down Expand Up @@ -57,6 +58,9 @@ protected virtual void OnDetaching() { }
/// </returns>
public object Execute(object sender, object parameter)
{
if (AssociatedObject == null)
throw new InvalidOperationException("AssociatedObject was not set before Execute.");

Invoke(parameter);
return null;
}
Expand Down

0 comments on commit 8a35356

Please sign in to comment.