From b77ba0339bf745e4aed8380ebda6812cb1bdaf8c Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Wed, 16 Sep 2020 14:22:42 -0400 Subject: [PATCH] initialize refsByID if it has not been initialized yet --- Libraries/UniversalEditor.Core/ObjectModelReference.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Libraries/UniversalEditor.Core/ObjectModelReference.cs b/Libraries/UniversalEditor.Core/ObjectModelReference.cs index ca6a888a..d88df384 100644 --- a/Libraries/UniversalEditor.Core/ObjectModelReference.cs +++ b/Libraries/UniversalEditor.Core/ObjectModelReference.cs @@ -95,6 +95,16 @@ namespace UniversalEditor /// True if an with the specified ID exists in the collection; false otherwise. public bool Contains(Guid ID) { + if (refsByID.Count == 0) + { + foreach (ObjectModelReference omr in this) + { + if (omr.ID != Guid.Empty) + { + refsByID.Add(omr.ID, omr); + } + } + } return (refsByID.ContainsKey(ID)); } ///