Skip to content

Commit 1ccad09

Browse files
committed
Combined if statements
1 parent ba57cf3 commit 1ccad09

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/ImageSharp/Formats/ImageFormatManager.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,9 @@ public void AddImageFormat(IImageFormat format)
102102
/// <returns><see langword="true"/> if a match is found; otherwise, <see langword="false"/></returns>
103103
public bool TryFindFormatByFileExtension(string extension, [NotNullWhen(true)] out IImageFormat? format)
104104
{
105-
if (!string.IsNullOrWhiteSpace(extension))
105+
if (!string.IsNullOrWhiteSpace(extension) && extension[0] == '.')
106106
{
107-
if (extension[0] == '.')
108-
{
109-
extension = extension[1..];
110-
}
107+
extension = extension[1..];
111108
}
112109

113110
format = this.imageFormats.FirstOrDefault(x =>

0 commit comments

Comments
 (0)