diff --git a/src/NerdBank.GitVersioning/ManagedGit/GitRepository.cs b/src/NerdBank.GitVersioning/ManagedGit/GitRepository.cs index c079b951..43f02885 100644 --- a/src/NerdBank.GitVersioning/ManagedGit/GitRepository.cs +++ b/src/NerdBank.GitVersioning/ManagedGit/GitRepository.cs @@ -719,6 +719,11 @@ private static bool TryConvertHexStringToByteArray(string hexString, Span /// public static unsafe string GetString(ReadOnlySpan bytes) { + if (bytes.Length == 0) + { + return string.Empty; + } + fixed (byte* pBytes = bytes) { return Encoding.GetString(pBytes, bytes.Length);