mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-28 11:03:49 +00:00
Issue found with PVS-Studio:
Many instances where we would create a object via a new call, and then check that it was non-null. This is redundant, as if we ever were in a situation where new failed, we'd be crashing left and right already, so the additional check is wasted processing.
This commit is contained in:
parent
db532c0e1a
commit
527c3790d6
15 changed files with 164 additions and 262 deletions
|
|
@ -564,31 +564,25 @@ void GuiInspector::refresh()
|
|||
ungroup = new GuiInspectorGroup( "Ungrouped", this );
|
||||
ungroup->setHeaderHidden( true );
|
||||
ungroup->setCanCollapse( false );
|
||||
if( ungroup != NULL )
|
||||
{
|
||||
ungroup->registerObject();
|
||||
mGroups.push_back( ungroup );
|
||||
addObject( ungroup );
|
||||
}
|
||||
|
||||
ungroup->registerObject();
|
||||
mGroups.push_back( ungroup );
|
||||
addObject( ungroup );
|
||||
}
|
||||
|
||||
// Put the 'transform' group first
|
||||
GuiInspectorGroup *transform = new GuiInspectorGroup( "Transform", this );
|
||||
if( transform != NULL )
|
||||
{
|
||||
transform->registerObject();
|
||||
mGroups.push_back( transform );
|
||||
addObject( transform );
|
||||
}
|
||||
|
||||
transform->registerObject();
|
||||
mGroups.push_back(transform);
|
||||
addObject(transform);
|
||||
|
||||
// Always create the 'general' group (for fields without a group)
|
||||
GuiInspectorGroup *general = new GuiInspectorGroup( "General", this );
|
||||
if( general != NULL )
|
||||
{
|
||||
general->registerObject();
|
||||
mGroups.push_back( general );
|
||||
addObject( general );
|
||||
}
|
||||
|
||||
general->registerObject();
|
||||
mGroups.push_back(general);
|
||||
addObject(general);
|
||||
|
||||
// Create the inspector groups for static fields.
|
||||
|
||||
|
|
@ -606,25 +600,23 @@ void GuiInspector::refresh()
|
|||
if( !group && !isGroupFiltered( itr->pGroupname ) )
|
||||
{
|
||||
GuiInspectorGroup *group = new GuiInspectorGroup( itr->pGroupname, this );
|
||||
if( group != NULL )
|
||||
|
||||
group->registerObject();
|
||||
if( !group->getNumFields() )
|
||||
{
|
||||
group->registerObject();
|
||||
if( !group->getNumFields() )
|
||||
{
|
||||
#ifdef DEBUG_SPEW
|
||||
Platform::outputDebugString( "[GuiInspector] Removing empty group '%s'",
|
||||
group->getCaption().c_str() );
|
||||
#endif
|
||||
#ifdef DEBUG_SPEW
|
||||
Platform::outputDebugString( "[GuiInspector] Removing empty group '%s'",
|
||||
group->getCaption().c_str() );
|
||||
#endif
|
||||
|
||||
// The group ended up having no fields. Remove it.
|
||||
group->deleteObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
mGroups.push_back( group );
|
||||
addObject( group );
|
||||
}
|
||||
}
|
||||
// The group ended up having no fields. Remove it.
|
||||
group->deleteObject();
|
||||
}
|
||||
else
|
||||
{
|
||||
mGroups.push_back( group );
|
||||
addObject( group );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -634,12 +626,10 @@ void GuiInspector::refresh()
|
|||
if ( !isGroupFiltered( "Dynamic Fields" ) )
|
||||
{
|
||||
GuiInspectorGroup *dynGroup = new GuiInspectorDynamicGroup( "Dynamic Fields", this);
|
||||
if( dynGroup != NULL )
|
||||
{
|
||||
dynGroup->registerObject();
|
||||
mGroups.push_back( dynGroup );
|
||||
addObject( dynGroup );
|
||||
}
|
||||
|
||||
dynGroup->registerObject();
|
||||
mGroups.push_back( dynGroup );
|
||||
addObject( dynGroup );
|
||||
}
|
||||
|
||||
if( mShowCustomFields && mTargets.size() == 1 )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue