From d6bdd25f70695d2fa0211ce87e35095b12683e45 Mon Sep 17 00:00:00 2001 From: Bastian Schmidt Date: Mon, 11 Apr 2016 11:20:08 +0200 Subject: [PATCH] Fixes #293 by checking the container for null --- Changelog.md | 7 ++++++- Fluent.Ribbon/Controls/BackstageTabControl.cs | 12 ++++++++++-- Shared/GlobalAssemblyInfo.cs | 4 ++-- appveyor.yml | 4 ++-- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Changelog.md b/Changelog.md index cf950fb3a..dc82feed0 100644 --- a/Changelog.md +++ b/Changelog.md @@ -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).** diff --git a/Fluent.Ribbon/Controls/BackstageTabControl.cs b/Fluent.Ribbon/Controls/BackstageTabControl.cs index adcfaca33..32306ae4a 100644 --- a/Fluent.Ribbon/Controls/BackstageTabControl.cs +++ b/Fluent.Ribbon/Controls/BackstageTabControl.cs @@ -328,14 +328,22 @@ protected override void OnSelectionChanged(SelectionChangedEventArgs e) #region Private methods - // Gets selected ribbon tab item + /// + /// Gets selected . + /// If there is no item selected, the first found item is selected and it's container () is returned. + /// + /// The currently selected . Or null of nothing was selected and nothing could be selected. 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; diff --git a/Shared/GlobalAssemblyInfo.cs b/Shared/GlobalAssemblyInfo.cs index fd4901ab0..f146631ff 100644 --- a/Shared/GlobalAssemblyInfo.cs +++ b/Shared/GlobalAssemblyInfo.cs @@ -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)] diff --git a/appveyor.yml b/appveyor.yml index 70bfa5a90..295ef4fc4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,7 +6,7 @@ only: - develop - version: 4.0.0-dev{build} + version: 4.0.1-dev{build} configuration: Release init: @@ -49,7 +49,7 @@ only: - master - version: 4.0.0.{build} + version: 4.0.1.{build} configuration: Release # Install scripts. (runs after repo cloning)