From 663738e98e1c71efcd91d30279e55bec7c41c0a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Tue, 8 Mar 2011 21:36:35 +0000 Subject: [PATCH] The whole file assumes fStyle cannot be NULL, and it can't be NULL unless there is no default font at all, in which case we have more serious worries. CID 1559. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40884 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/ServerFont.cpp | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/servers/app/ServerFont.cpp b/src/servers/app/ServerFont.cpp index 44e2e42d0c..a26c15740b 100644 --- a/src/servers/app/ServerFont.cpp +++ b/src/servers/app/ServerFont.cpp @@ -174,18 +174,16 @@ ServerFont::~ServerFont() ServerFont& ServerFont::operator=(const ServerFont& font) { - if (font.fStyle) { - fSize = font.fSize; - fRotation = font.fRotation; - fShear = font.fShear; - fFalseBoldWidth = font.fFalseBoldWidth; - fFlags = font.fFlags; - fSpacing = font.fSpacing; - fEncoding = font.fEncoding; - fBounds = font.fBounds; + fSize = font.fSize; + fRotation = font.fRotation; + fShear = font.fShear; + fFalseBoldWidth = font.fFalseBoldWidth; + fFlags = font.fFlags; + fSpacing = font.fSpacing; + fEncoding = font.fEncoding; + fBounds = font.fBounds; - SetStyle(font.fStyle); - } + SetStyle(font.fStyle); return *this; } @@ -194,9 +192,6 @@ ServerFont::operator=(const ServerFont& font) bool ServerFont::operator==(const ServerFont& other) const { - if (fStyle == NULL && other.fStyle == NULL) - return true; - if (GetFamilyAndStyle() != other.GetFamilyAndStyle()) return false; @@ -249,8 +244,7 @@ ServerFont::SetStyle(FontStyle* style) { if (style && style != fStyle) { // detach from old style - if (fStyle) - fStyle->Release(); + fStyle->Release(); // attach to new style fStyle = style; @@ -284,7 +278,7 @@ ServerFont::SetFamilyAndStyle(uint16 familyID, uint16 styleID) gFontManager->Unlock(); } - if (!style) + if (style == NULL) return B_ERROR; SetStyle(style);