Skip to content

Commit

Permalink
Fixes #293 by checking the container for null
Browse files Browse the repository at this point in the history
  • Loading branch information
batzen committed Apr 11, 2016
1 parent e7794d0 commit d6bdd25
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
7 changes: 6 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog for Fluent.Ribbon

## 4.0.0 (preview)
## 4.0.1

- ### Bug fixes
- [#293](../../issues/293) - ArgumentNullException in BackstageTabControl while trying to find the selected tab

## 4.0.0

- ### Notices
- **As of now the Office 2010 and Windows 8 themes will be removed in version 5.0. You can vote for this at [Future direction of this library](../../issues/282).**
Expand Down
12 changes: 10 additions & 2 deletions Fluent.Ribbon/Controls/BackstageTabControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,22 @@ protected override void OnSelectionChanged(SelectionChangedEventArgs e)

#region Private methods

// Gets selected ribbon tab item
/// <summary>
/// Gets selected <see cref="BackstageTabItem"/>.
/// If there is no item selected, the first found item is selected and it's container (<see cref="BackstageTabItem"/>) is returned.
/// </summary>
/// <returns>The currently selected <see cref="BackstageTabItem"/>. Or null of nothing was selected and nothing could be selected.</returns>
private BackstageTabItem GetSelectedTabItem()
{
var container = this.ItemContainerGenerator.ContainerFromItem(this.SelectedItem) as BackstageTabItem;
if (container == null)
{
container = this.FindNextTabItem(this.SelectedIndex, 1);
this.SelectedItem = this.ItemContainerGenerator.ItemFromContainer(container);

if (container != null)
{
this.SelectedItem = this.ItemContainerGenerator.ItemFromContainer(container);
}
}

return container;
Expand Down
4 changes: 2 additions & 2 deletions Shared/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("4.0.0.0")]
[assembly: AssemblyFileVersion("4.0.0.0")]
[assembly: AssemblyVersion("4.0.1.0")]
[assembly: AssemblyFileVersion("4.0.1.0")]
[assembly: AssemblyInformationalVersion("SRC")]

[assembly: ComVisible(false)]
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
only:
- develop

version: 4.0.0-dev{build}
version: 4.0.1-dev{build}
configuration: Release

init:
Expand Down Expand Up @@ -49,7 +49,7 @@
only:
- master

version: 4.0.0.{build}
version: 4.0.1.{build}
configuration: Release

# Install scripts. (runs after repo cloning)
Expand Down

0 comments on commit d6bdd25

Please sign in to comment.