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

svn-id: r47272
This commit is contained in:
Johannes Schickel 2010-01-12 19:07:03 +00:00
parent c1e4156587
commit 003c62fee8

View File

@ -41,8 +41,7 @@ Text::Text(ResourceManager *resMan, Gfx *gfx, Screen *screen)
}
Text::~Text() {
if (_font != NULL)
delete _font;
delete _font;
}
void Text::init() {
@ -59,8 +58,7 @@ GuiResourceId Text::GetFontId() {
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 @@ Font *Text::GetFont() {
void Text::SetFont(GuiResourceId fontId) {
if ((_font == NULL) || (_font->getResourceId() != fontId)) {
if (_font != NULL)
delete _font;
delete _font;
_font = new Font(_resMan, fontId);
}