]> git.saurik.com Git - wxWidgets.git/commitdiff
Add some wxCHECK_MSG's
authorRobin Dunn <robin@alldunn.com>
Sun, 21 Jan 2007 06:53:42 +0000 (06:53 +0000)
committerRobin Dunn <robin@alldunn.com>
Sun, 21 Jan 2007 06:53:42 +0000 (06:53 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44277 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/font.cpp

index 5fa73ec64464ffdbd3275beebe904e496776abf1..397a8c14f06d0865e6c056716828262bba03a5f0 100644 (file)
@@ -1020,6 +1020,8 @@ int wxFont::GetPointSize() const
 
 wxSize wxFont::GetPixelSize() const
 {
+    wxCHECK_MSG( Ok(), wxDefaultSize, wxT("invalid font") );
+
     return M_FONTDATA->GetPixelSize();
 }
 
@@ -1074,12 +1076,14 @@ wxFontEncoding wxFont::GetEncoding() const
 
 const wxNativeFontInfo *wxFont::GetNativeFontInfo() const
 {
-    return M_FONTDATA->HasNativeFontInfo() ? &(M_FONTDATA->GetNativeFontInfo())
+    return Ok() && M_FONTDATA->HasNativeFontInfo() ? &(M_FONTDATA->GetNativeFontInfo())
                                            : NULL;
 }
 
 wxString wxFont::GetNativeFontInfoDesc() const
 {
+    wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid font") );
+
     // be sure we have an HFONT associated...
     wxConstCast(this, wxFont)->RealizeResource();
     return wxFontBase::GetNativeFontInfoDesc();
@@ -1087,6 +1091,8 @@ wxString wxFont::GetNativeFontInfoDesc() const
 
 wxString wxFont::GetNativeFontInfoUserDesc() const
 {
+    wxCHECK_MSG( Ok(), wxEmptyString, wxT("invalid font") );
+
     // be sure we have an HFONT associated...
     wxConstCast(this, wxFont)->RealizeResource();
     return wxFontBase::GetNativeFontInfoUserDesc();