diff --git a/src/Avalonia.Base/Utilities/AvaloniaPropertyDictionary.cs b/src/Avalonia.Base/Utilities/AvaloniaPropertyDictionary.cs index 434c94b1e5..e5a6e5a825 100644 --- a/src/Avalonia.Base/Utilities/AvaloniaPropertyDictionary.cs +++ b/src/Avalonia.Base/Utilities/AvaloniaPropertyDictionary.cs @@ -82,7 +82,15 @@ namespace Avalonia.Utilities /// /// The index of the entry, between 0 and - 1. /// - public TValue this[int index] => _entries![index].Value; + public TValue this[int index] + { + get + { + if (_entries is null) + ThrowArgumentOutOfRange(); + return _entries[index].Value; + } + } /// /// Adds the specified key and value to the dictionary.