Program halts trying to access an array element

I have a rather sprawling program, mostly working well. But occasionally I the following code encounters an issue, and I can't figure out why.


let targetIndex = curLevel?.targets.firstIndex(where: { $0.uuid == uuid! })
print( targetIndex! )
dump( curLevel?.targets[targetIndex!] )


Here's what gets displayed when the program encounters a problem:

6

▿ Optional(myApp.MyClass)

▿ some: myApp.MyClass #0

- scnnode: 2020-03-07 14:28:05.924360-0800 myApp[3565:1198541] [ViceroyTrace] [ERROR] AGPSessionRecvFrom:1954 0x15bdf00e0 sack: SEARCH FAILURE SERIAL NUMBER (00000190) FROM (7F9903B1)...

Replies

Does your program crash ?

If so, how are you sure it crashes here ?


How are targets defined ?


Is it a sceneKit class ?


You should give more context information.