diff --git a/Source/Settings/ConfigurationFileStore.Test.cs b/Source/Settings/ConfigurationFileStore.Test.cs index 8e6cb67..fa00c1a 100644 --- a/Source/Settings/ConfigurationFileStore.Test.cs +++ b/Source/Settings/ConfigurationFileStore.Test.cs @@ -319,7 +319,7 @@ namespace Nuclex.Support.Settings { } /// - /// Verifies that it's possible to assign an empty value to an option + /// Verifies that options are removed from the configuration file correctly /// [Test] public void RemovingOptionShiftsFollowingOptionsUp() { @@ -355,7 +355,7 @@ namespace Nuclex.Support.Settings { } /// - /// Verifies that it's not an error to remove a non-existing option + /// Verifies that the configuration file store can identify various types of values /// [ Test, diff --git a/Source/Settings/WindowsRegistryStore.Test.cs b/Source/Settings/WindowsRegistryStore.Test.cs index 4c46c0c..d233ca6 100644 --- a/Source/Settings/WindowsRegistryStore.Test.cs +++ b/Source/Settings/WindowsRegistryStore.Test.cs @@ -180,6 +180,16 @@ namespace Nuclex.Support.Settings { } } + /// + /// Verifies that it's possible to enumerate a category that doesn't exist + /// + [Test] + public void NonExistingCategoryCanBeEnumerated() { + using(var context = new TestContext()) { + Assert.That(context.Store.EnumerateOptions("doesn't exist"), Is.Empty); + } + } + /// Verifies that byte arrays can be stored in the registry [Test] public void ByteArraysCanBeStored() { diff --git a/Source/Settings/WindowsRegistryStore.cs b/Source/Settings/WindowsRegistryStore.cs index 5720fa9..dff2609 100644 --- a/Source/Settings/WindowsRegistryStore.cs +++ b/Source/Settings/WindowsRegistryStore.cs @@ -82,6 +82,9 @@ namespace Nuclex.Support.Settings { } } else { using(RegistryKey categoryKey = this.rootKey.OpenSubKey(category, this.writable)) { + if(categoryKey == null) { + yield break; + } string[] valueNames = categoryKey.GetValueNames(); for(int index = 0; index < valueNames.Length; ++index) { yield return new OptionInfo() {