0026120: Visualization - segmentation fault in AIS_Selection
authorvpa <vpa@opencascade.com>
Wed, 22 Apr 2015 11:25:31 +0000 (14:25 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 23 Apr 2015 13:16:23 +0000 (16:16 +0300)
Added NULL-pointer checks

src/AIS/AIS_Selection.cxx

index a86a3a4..0ea8f3a 100644 (file)
@@ -230,6 +230,10 @@ void AIS_Selection::ClearAndSelect(const Handle(Standard_Transient)& anObject) {
 Standard_Integer AIS_Selection::Extent() {
   Handle(AIS_Selection) S;
   AIS_Sel_CurrentSelection (S);
+
+  if (S.IsNull())
+    return 0;
+
   return S->myresult.Extent();
 }
 
@@ -241,7 +245,10 @@ Handle(Standard_Transient)  AIS_Selection::Single()
 {
   Handle(AIS_Selection) S;
   AIS_Sel_CurrentSelection (S);
-  
+
+  if (S.IsNull())
+    return Handle(Standard_Transient)();
+
   S->Init();
   return S->Value();
 }