1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0023799: Crash on copying a label

A check on NULL is added to prevent the crash.
Adding test case for this fix
This commit is contained in:
bugmaster
2013-04-01 11:47:08 +04:00
committed by vro
parent 973191093d
commit 643cc6aae4
4 changed files with 40 additions and 8 deletions

View File

@@ -97,13 +97,16 @@ void TDF_CopyLabel::ExternalReferences(const TDF_Label& aRefLabel, const TDF_Lab
// TDF_Tool::Entry(att->Label(), entr1);
// cout<<"\t\tReferences attribute dynamic type = "<<att->DynamicType()<<" Label = "<<entr1 <<endl;
if (aFilter.IsKept(att) && att->Label().IsDifferent(aRefLabel) &&
!att->Label().IsDescendant(aRefLabel)) {
aExternals.Add(att);
extRefFound = Standard_True;
if (!att.IsNull() && !att->Label().IsNull())
{
if (aFilter.IsKept(att) && att->Label().IsDifferent(aRefLabel) &&
!att->Label().IsDescendant(aRefLabel)) {
aExternals.Add(att);
extRefFound = Standard_True;
}
}
}
// const TDF_LabelMap& labMap = ds->Labels();
// for (TDF_MapIteratorOfLabelMap labMItr(labMap);labMItr.More(); labMItr.Next()) {
// TDF_Tool::Entry(labMItr.Key(), entr1);

View File

@@ -181,9 +181,12 @@ static Standard_Boolean TDF_Tool_DescendantRef
// CLE
// const Handle(TDF_Attribute)& att = attMItr.Key();
Handle(TDF_Attribute) att = attMItr.Key();
// ENDCLE
if (aFilter.IsKept(att) && !att->Label().IsDescendant(aRefLabel))
return Standard_False;
if (!att.IsNull() && !att->Label().IsNull())
{
// ENDCLE
if (aFilter.IsKept(att) && !att->Label().IsDescendant(aRefLabel))
return Standard_False;
}
}
ds->Clear();
}