How to escape from NullReferenceException? (10.4 KB)

I understand that I cannot check if it is a clipping plane if the sticky value is Null, but I don’t understand why does it even go into the second if, when the sticky doesn’t even exist upon opening of the file.

@ivelin.peychev, if you open your definition with a document which does not have a sticky entry (after reopening Rhino, as sticky persists between sessions), the error comes from the clipping plane function in at line 51.

My guess is you need to add some error checking before adding the sticky value and only pass a valid plane to rs.AddClippingPlane then check if the return value is not System.Guid.Empty. If it is, do not add that empty Guid to the sticky.