mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-11 14:44:36 +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
|
|
@ -39,15 +39,12 @@ FileStream *FileStream::createAndOpen(const String &inFileName, Torque::FS::File
|
|||
{
|
||||
FileStream *newStream = new FileStream;
|
||||
|
||||
if ( newStream )
|
||||
{
|
||||
bool success = newStream->open( inFileName, inMode );
|
||||
bool success = newStream->open( inFileName, inMode );
|
||||
|
||||
if ( !success )
|
||||
{
|
||||
delete newStream;
|
||||
newStream = NULL;
|
||||
}
|
||||
if ( !success )
|
||||
{
|
||||
delete newStream;
|
||||
newStream = NULL;
|
||||
}
|
||||
|
||||
return newStream;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue