How to catch an error on SCNReferenceNode.referenceURL property (SceneKit)?

The problem is that if I create SCNReferenceNode and try to get referenceURL

...
        let refNode: SCNReferenceNode = SCNReferenceNode()
        let curUrl = refNode.referenceURL
...

in order to check if it is nil, I got an exception

Thread 1: EXC_BREAKPOINT (code=1, subcode=0x186d06dd0)

And looks like there is no way to work around this.

P.S. I know there is an option to give an URL to the constructor like SCNReferenceNode(myURL), but I have to use an approach where I create SCNReferenceNode before then refURL is available.

in order to check if it is nil, I got an exception

How do you make the check ?

Did you try:

if let curUrl = refNode?.referenceURL {
  print("Not nil")
} else {
  print("Nil")
How to catch an error on SCNReferenceNode.referenceURL property (SceneKit)?
 
 
Q