Skip to content

Commit e155be8

Browse files
Update CommandDescriptor.cs
1 parent 995d670 commit e155be8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/ImageSharp.Web/Commands/CommandDescriptor.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Six Labors.
1+
// Copyright (c) Six Labors.
22
// Licensed under the Apache License, Version 2.0.
33

44
using System;
@@ -50,14 +50,13 @@ public static ICommandConverter GetConverter(Type type)
5050
/// </exception>
5151
public static void AddConverter(Type type, Type converter)
5252
{
53-
Guard.IsTrue(typeof(ICommandConverter).IsAssignableFrom(converter), nameof(converter), "Converter does not implement ICommandConverter.");
53+
const string Message = "Converter does not implement ICommandConverter.";
54+
Guard.IsTrue(typeof(ICommandConverter).IsAssignableFrom(converter), nameof(converter), Message);
5455

55-
if (ConverterCache.ContainsKey(type))
56+
if (!ConverterCache.ContainsKey(type))
5657
{
57-
return;
58+
ConverterCache[type] = (ICommandConverter)Activator.CreateInstance(converter);
5859
}
59-
60-
ConverterCache[type] = (ICommandConverter)Activator.CreateInstance(converter);
6160
}
6261
}
63-
}
62+
}

0 commit comments

Comments
 (0)