Use TryGetValue instead

This commit is contained in:
Bjarke Berg
2024-04-18 20:44:26 +02:00
parent 61908b4235
commit 5c16cfb947

View File

@@ -83,8 +83,7 @@ internal class BlockEditorValues
private bool ResolveBlockItemData(BlockItemData block, Dictionary<string, Dictionary<string, IPropertyType>> contentTypePropertyTypes, IDictionary<Guid, IContentType> contentTypesDictionary)
{
IContentType? contentType = contentTypesDictionary[block.ContentTypeKey];
if (contentType == null)
if (contentTypesDictionary.TryGetValue(block.ContentTypeKey, out IContentType? contentType) is false)
{
return false;
}