Skip to content

Commit

Permalink
Remove null-terminator that was actually useless
Browse files Browse the repository at this point in the history
  • Loading branch information
Exter-N authored and Ottermandias committed Jun 20, 2023
1 parent 22cb33e commit f88b576
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Penumbra/Interop/ResourceTree/ResolveContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@ internal record class ResolveContext(Configuration Config, IObjectIdentifier Ide

if (gamePath[lastDirectorySeparator + 1] != (byte)'-' || gamePath[lastDirectorySeparator + 2] != (byte)'-')
{
Span<byte> prefixed = stackalloc byte[gamePath.Length + 3];
Span<byte> prefixed = stackalloc byte[gamePath.Length + 2];
gamePath.Span[..(lastDirectorySeparator + 1)].CopyTo(prefixed);
prefixed[lastDirectorySeparator + 1] = (byte)'-';
prefixed[lastDirectorySeparator + 2] = (byte)'-';
gamePath.Span[(lastDirectorySeparator + 1)..].CopyTo(prefixed[(lastDirectorySeparator + 3)..]);
prefixed[^1] = 0;

if (!Utf8GamePath.FromSpan(prefixed[..^1], out var tmp))
if (!Utf8GamePath.FromSpan(prefixed, out var tmp))
return null;

gamePath = tmp.Path.Clone();
Expand Down

0 comments on commit f88b576

Please sign in to comment.