Browse Source

Add null check.

pull/8571/head
Steven Kirk 4 years ago
parent
commit
7b0f5368a1
  1. 10
      src/Avalonia.Base/Utilities/AvaloniaPropertyDictionary.cs

10
src/Avalonia.Base/Utilities/AvaloniaPropertyDictionary.cs

@ -82,7 +82,15 @@ namespace Avalonia.Utilities
/// <param name="index">
/// The index of the entry, between 0 and <see cref="Count"/> - 1.
/// </param>
public TValue this[int index] => _entries![index].Value;
public TValue this[int index]
{
get
{
if (_entries is null)
ThrowArgumentOutOfRange();
return _entries[index].Value;
}
}
/// <summary>
/// Adds the specified key and value to the dictionary.

Loading…
Cancel
Save