fix: NRE on commit filters

This commit is contained in:
leo 2024-07-29 19:40:35 +08:00
parent 20744d09bd
commit d2d95e09b7
No known key found for this signature in database

View file

@ -87,6 +87,8 @@ namespace SourceGit.Converters
public static readonly FuncValueConverter<string, string> TrimRefsPrefix = public static readonly FuncValueConverter<string, string> TrimRefsPrefix =
new FuncValueConverter<string, string>(v => new FuncValueConverter<string, string>(v =>
{ {
if (v == null)
return string.Empty;
if (v.StartsWith("refs/heads/", StringComparison.Ordinal)) if (v.StartsWith("refs/heads/", StringComparison.Ordinal))
return v.Substring(11); return v.Substring(11);
if (v.StartsWith("refs/remotes/", StringComparison.Ordinal)) if (v.StartsWith("refs/remotes/", StringComparison.Ordinal))