Group Group Group Group Group Group Group Group Group

Tree Deserialize solution bug

Hello,

On page 339, solution for deserialize the tree need extra condition

// 2
guard let value = array.removeFirst() else {

should be changed to:
// 2
guard !array.isEmpty, let value = array.removeFirst() else {

Otherwise it results in error “Can’t remove first element from empty collection”

Best,

@oaranger Thank you for your solution - much appreciated! We will definitely fix this in the next version of the book.

This will be resolved in the next release! Thanks for reporting