Change selection mode and click the background will raising error

Hello,

I try to develop a simple CAM software in C# winform. Now when I change the selection mode to Solid or Face ...etc, and if I click nothing in the cad model(position like the image file attached, and I have already written if selected shape is null condition but it doesn't work), it will raise error in Standard_Handle.hxx about System.NullReferenceException. Can anyone give me suggestion. Thanks a lot.

Sincerely, Steven

Attachments: 
Kirill Gavrilov's picture

The most straightforward approach would be debugging application and fixing NULL-dereference by adding missing .IsNull() check. That all that one could read from attached screenshot.

顯舜 徐's picture

Thank you for your hint, Mr. Gavrilov. I use AIS_InteractiveContext::HasDetectedShape(), and it works!