diff --git a/src/Lavalink4NET.Abstractions/Tracks/Serialization/LavalinkTrack.IFormattable.cs b/src/Lavalink4NET.Abstractions/Tracks/Serialization/LavalinkTrack.IFormattable.cs index 227078ec..313e9c52 100644 --- a/src/Lavalink4NET.Abstractions/Tracks/Serialization/LavalinkTrack.IFormattable.cs +++ b/src/Lavalink4NET.Abstractions/Tracks/Serialization/LavalinkTrack.IFormattable.cs @@ -11,7 +11,13 @@ public partial record class LavalinkTrack : ISpanFormattable public override string ToString() => ToString(version: null); - public string ToString(int? version) => Utf8ToUtf16(Serialize(version)); + public string ToString(int? version) + { + if (TrackData is null || version is not null) + TrackData = Utf8ToUtf16(Serialize(version)); + + return TrackData; + } public bool TryFormat(Span destination, out int charsWritten, ReadOnlySpan format, IFormatProvider? provider) { diff --git a/src/Lavalink4NET.Abstractions/Tracks/Serialization/LavalinkTrack.Serialize.cs b/src/Lavalink4NET.Abstractions/Tracks/Serialization/LavalinkTrack.Serialize.cs index 0b33443b..d1efd544 100644 --- a/src/Lavalink4NET.Abstractions/Tracks/Serialization/LavalinkTrack.Serialize.cs +++ b/src/Lavalink4NET.Abstractions/Tracks/Serialization/LavalinkTrack.Serialize.cs @@ -50,7 +50,7 @@ public byte[] Serialize(int? version = null) ? long.MaxValue : (long)Math.Round(Duration.TotalMilliseconds); - writer.Write(version.Value); + writer.Write((byte)version.Value); writer.Write(Title); writer.Write(Author); writer.Write(duration);