mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +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:
parent
973191093d
commit
643cc6aae4
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
25
tests/bugs/caf/bug23799
Executable file
25
tests/bugs/caf/bug23799
Executable file
@ -0,0 +1,25 @@
|
||||
puts "============"
|
||||
puts "OCC23799"
|
||||
puts "============"
|
||||
puts ""
|
||||
#######################################################################
|
||||
# Crash on copying a label
|
||||
#######################################################################
|
||||
|
||||
set BugNumber OCC23799
|
||||
|
||||
# Create a new document
|
||||
NewDocument D
|
||||
|
||||
psphere s 100
|
||||
explode s f
|
||||
|
||||
ImportShape D 0:1 s
|
||||
SelectShape D 0:2 s_1 s
|
||||
ForgetAll D 0:1
|
||||
|
||||
if { [catch [CopyLabel D 0:2 0:3] ] != 0 } {
|
||||
puts "${BugNumber}: Error copy label"
|
||||
} else {
|
||||
puts "${BugNumber}: OK"
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
puts "TODO ?#22623 ALL: \\*\\* Exception"
|
||||
puts "TODO ?#22623 ALL: An exception was caught"
|
||||
puts "TODO ?#22623 ALL: TEST INCOMPLETE"
|
||||
|
||||
puts "============"
|
||||
puts "OCC22623"
|
||||
|
Loading…
x
Reference in New Issue
Block a user