Simplify expression

ternary with a null check and long method signature is pretty ugly
This commit is contained in:
Kurt 2019-02-09 23:22:22 -08:00
parent 54ba9a0312
commit a39f917f84

View file

@ -796,9 +796,9 @@ namespace PKHeX.Core
/// <returns>Format hint that the file is.</returns>
public static int GetPKMFormatFromExtension(string ext, int prefer)
{
return ext?.Length > 1
? GetPKMFormatFromExtension(ext[ext.Length - 1], prefer)
: prefer;
if (string.IsNullOrEmpty(ext))
return prefer;
return GetPKMFormatFromExtension(ext[ext.Length - 1], prefer);
}
/// <summary>