Crash in Chapter 6.6

for end index, it returns tail?.next
Can anyone confirm if this is intended?
Using this crash the application as I expected cause tail is already the last node and tail.next is nil