'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.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source