diff --git a/BeefLibs/corlib/src/Collections/Queue.bf b/BeefLibs/corlib/src/Collections/Queue.bf index 3bfe83a7..f92b9a63 100644 --- a/BeefLibs/corlib/src/Collections/Queue.bf +++ b/BeefLibs/corlib/src/Collections/Queue.bf @@ -413,12 +413,21 @@ namespace System.Collections /// Returns the object at the head of the queue. The object remains in the /// queue. If the queue is empty, this method returns an error - public Result Peek() + public Result TryPeek() { if (mSize == 0) return .Err; return .Ok(mItems[mHead]); } + + /// Returns the object at the head of the queue. The object remains in the + /// queue. If the queue is empty, this method fails + public T Peek() + { + if (mSize == 0) + Runtime.FatalError("Queue empty"); + return mItems[mHead]; + } /// Returns true if the queue contains at least one object equal to 'item'. public bool Contains(T item)