Skip to content

Commit

Permalink
fix DelegateBuilder where no canExecute function was set
Browse files Browse the repository at this point in the history
  • Loading branch information
tibel committed Apr 29, 2015
1 parent 7e62ec1 commit c1f9b58
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nuget/Caliburn.Light.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>Caliburn.Light</id>
<title>Caliburn.Light</title>
<version>2.0.0</version>
<version>2.0.1</version>
<authors>Thomas Ibel</authors>
<description>The magic-free Caliburn.Light, a powerful framework designed for building applications across current XAML platforms.</description>
<language>en-US</language>
Expand Down
6 changes: 5 additions & 1 deletion src/Caliburn.Core/Action/DelegateCommandBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ public IDelegateCommand Build()
if (!string.IsNullOrEmpty(_propertyName) && _canExecute == null)
throw new InvalidOperationException("PropertyName is set but CanExecute is not.");

return new DelegateCommandImpl<TTarget, object>(_target, (t, p) => _execute(t), (t, p) => _canExecute(t), _propertyName);
Func<TTarget, object, bool> canExecute = null;
if (_canExecute != null)
canExecute = (t, p) => _canExecute(t);

return new DelegateCommandImpl<TTarget, object>(_target, (t, p) => _execute(t), canExecute, _propertyName);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
#endif

[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.0.1.0")]

0 comments on commit c1f9b58

Please sign in to comment.