From 8d64c0cc404177c472fb7c35b881cbb790d8a31b Mon Sep 17 00:00:00 2001 From: vpa Date: Wed, 22 Apr 2015 14:25:31 +0300 Subject: [PATCH] 0026120: Visualization - segmentation fault in AIS_Selection Added NULL-pointer checks --- src/AIS/AIS_Selection.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/AIS/AIS_Selection.cxx b/src/AIS/AIS_Selection.cxx index a86a3a4056..0ea8f3af6f 100644 --- a/src/AIS/AIS_Selection.cxx +++ b/src/AIS/AIS_Selection.cxx @@ -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(); }