From 68585e1770c9d9793fd65fc454dc7ddd682b0088 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sun, 21 Jan 2007 06:53:42 +0000 Subject: [PATCH] Add some wxCHECK_MSG's git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44277 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/font.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/msw/font.cpp b/src/msw/font.cpp index 5fa73ec644..397a8c14f0 100644 --- a/src/msw/font.cpp +++ b/src/msw/font.cpp @@ -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();