8000 Fix dummy NRE mistake · dotnet/wpf@a1c2ab7 · GitHub
[go: up one dir, main page]

Skip to content

Commit a1c2ab7

Browse files
committed
Fix dummy NRE mistake
1 parent 0a4cc57 commit a1c2ab7

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/AssemblyNamespacePair.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
3-
// See the LICENSE file in the project root for more information.
43

5-
using System.Diagnostics;
64
using System.Reflection;
75

86
namespace System.Xaml.MS.Impl

src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/XamlNamespace.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ internal int RevisionNumber
169169
{
170170
// The only external mutation we allow is adding new namespaces. So the count of
171171
// namespaces also serves as a revision number.
172-
get => (_assemblyNamespaces != null) ? _assemblyNamespaces.Length : 0;
172+
get => _assemblyNamespaces?.Length ?? 0;
173173
}
174174

175175
private Type TryGetType(string typeName)
@@ -279,12 +279,13 @@ internal void AddAssemblyNamespacePair(AssemblyNamespacePair pair)
279279
}
280280
else
281281
{
282+
// Copy items over to the new collection
282283
assemblyNamespacesCopy = new AssemblyNamespacePair[_assemblyNamespaces.Length + 1];
284+
_assemblyNamespaces.CopyTo(assemblyNamespacesCopy, 0);
283285
}
284286

285-
// Copy over and add new item
286-
_assemblyNamespaces.CopyTo(assemblyNamespacesCopy, 0);
287-
assemblyNamespacesCopy[assemblyNamespacesCopy.Length - 1] = pair;
287+
// Add new pair as the last one
288+
assemblyNamespacesCopy[^1] = pair;
288289

289290
_assemblyNamespaces = assemblyNamespacesCopy;
290291
}

0 commit comments

Comments
 (0)
0