[Scummvm-cvs-logs] SF.net SVN: scummvm:[47272] scummvm/trunk/engines/sci/graphics/text.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Jan 12 20:07:03 CET 2010


Revision: 47272
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47272&view=rev
Author:   lordhoto
Date:     2010-01-12 19:07:03 +0000 (Tue, 12 Jan 2010)

Log Message:
-----------
A null pointer can be safely passed to "delete", thus there is no need to check against the pointer being non-zero in advance.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/text.cpp

Modified: scummvm/trunk/engines/sci/graphics/text.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/text.cpp	2010-01-12 18:48:47 UTC (rev 47271)
+++ scummvm/trunk/engines/sci/graphics/text.cpp	2010-01-12 19:07:03 UTC (rev 47272)
@@ -41,8 +41,7 @@
 }
 
 Text::~Text() {
-	if (_font != NULL)
-		delete _font;
+	delete _font;
 }
 
 void Text::init() {
@@ -59,8 +58,7 @@
 
 Font *Text::GetFont() {
 	if ((_font == NULL) || (_font->getResourceId() != _gfx->_curPort->fontId)) {
-		if (_font != NULL)
-			delete _font;
+		delete _font;
 		_font = new Font(_resMan, _gfx->_curPort->fontId);
 	}
 
@@ -69,8 +67,7 @@
 
 void Text::SetFont(GuiResourceId fontId) {
 	if ((_font == NULL) || (_font->getResourceId() != fontId)) {
-		if (_font != NULL)
-			delete _font;
+		delete _font;
 		_font = new Font(_resMan, fontId);
 	}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list