enhance: avoid crash when missing parameters to format string

This commit is contained in:
leo 2024-06-18 10:19:55 +08:00
parent f79dc1f91f
commit 2f6519fa4d
No known key found for this signature in database
GPG key ID: B528468E49CD0E58

View file

@ -191,6 +191,10 @@ namespace SourceGit
var fmt = Current.FindResource($"Text.{key}") as string; var fmt = Current.FindResource($"Text.{key}") as string;
if (string.IsNullOrWhiteSpace(fmt)) if (string.IsNullOrWhiteSpace(fmt))
return $"Text.{key}"; return $"Text.{key}";
if (args == null || args.Length == 0)
return fmt;
return string.Format(fmt, args); return string.Format(fmt, args);
} }