You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there is a bug in the implementation of Queue.deQueue() . Consider the following code:
var w = Queue<Int>()
println(w.count) // prints "0" as expected
w.enQueue(1)
println(w.count) // prints "1" - as expected
w.deQueue()
println(w.count) // should print "0", but instead, you get a fatal error
In xCode 6.3.1, this code in a playground gives the following fatal error: fatal error: unexpectedly found nil while unwrapping an Optional value Playground execution failed: Execution was interrupted, reason: EXC_BAD_INSTRUCTION
This is due to the fact that deQueue() at line 102 sets top to nil when there is no next item in the queue. count then blows up when it tries to access top.key which is an implicitly unwrapped optional. A fix would be to instead set top to QNode<T>() on 102.
The text was updated successfully, but these errors were encountered:
I think there is a bug in the implementation of
Queue.deQueue()
. Consider the following code:In xCode 6.3.1, this code in a playground gives the following fatal error:
fatal error: unexpectedly found nil while unwrapping an Optional value Playground execution failed: Execution was interrupted, reason: EXC_BAD_INSTRUCTION
This is due to the fact that deQueue() at line 102 sets
top
tonil
when there is no next item in the queue.count
then blows up when it tries to accesstop.key
which is an implicitly unwrapped optional. A fix would be to instead settop
toQNode<T>()
on 102.The text was updated successfully, but these errors were encountered: