Skip to content

Commit

Permalink
fix: null return hints
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Jan 22, 2025
1 parent 96b8eb3 commit 2419947
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DisCatSharp.Lavalink/LavalinkGuildPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ public void AddToQueue(LavalinkPlaylist playlist)
/// </summary>
/// <param name="track">The next track in the queue, or null if the queue is empty.</param>
/// <returns>True if a track was found, false otherwise.</returns>
public bool TryPeekQueue(out LavalinkTrack? track)
public bool TryPeekQueue([NotNullWhen(true)] out LavalinkTrack? track)
{
if (QueueInternal.TryGetValue(this.GuildId, out var queue) && queue.TryPeek(out var result))
{
Expand Down
5 changes: 3 additions & 2 deletions DisCatSharp.Lavalink/LavalinkQueue.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

namespace DisCatSharp.Lavalink;

Expand Down Expand Up @@ -115,7 +116,7 @@ public bool TryDequeue(out T value)
/// <see langword="true" /> if there is an object at the beginning of the <see cref="LavalinkQueue{T}" />;
/// otherwise, <see langword="false" />.
/// </returns>
public bool TryPeek(out T value)
public bool TryPeek([NotNullWhen(true)] out T? value)
{
lock (this._list)
{
Expand All @@ -125,7 +126,7 @@ public bool TryPeek(out T value)
return false;
}

value = this._list.First.Value;
value = this._list.First.Value!;
return true;
}
}
Expand Down

0 comments on commit 2419947

Please sign in to comment.