From 2f6519fa4d6119970d7c38ade7de0756c589ff8b Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 18 Jun 2024 10:19:55 +0800 Subject: [PATCH] enhance: avoid crash when missing parameters to format string --- src/App.axaml.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/App.axaml.cs b/src/App.axaml.cs index 69917120..f1676fa3 100644 --- a/src/App.axaml.cs +++ b/src/App.axaml.cs @@ -191,6 +191,10 @@ namespace SourceGit var fmt = Current.FindResource($"Text.{key}") as string; if (string.IsNullOrWhiteSpace(fmt)) return $"Text.{key}"; + + if (args == null || args.Length == 0) + return fmt; + return string.Format(fmt, args); }