guarding all text methods against unset font

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@54918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2008-08-02 06:31:46 +00:00
parent 49d9fc10e4
commit bc217fe9dc
3 changed files with 19 additions and 6 deletions

View File

@@ -1214,7 +1214,9 @@ void wxGDIPlusContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxD
void wxGDIPlusContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
{
if ( m_font.IsNull() || str.IsEmpty())
wxCHECK_RET( !m_font.IsNull(), wxT("wxGDIPlusContext::DrawText - no valid font set") );
if ( str.IsEmpty())
return ;
wxWCharBuffer s = str.wc_str( *wxConvUI );
@@ -1225,6 +1227,8 @@ void wxGDIPlusContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
void wxGDIPlusContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height,
wxDouble *descent, wxDouble *externalLeading ) const
{
wxCHECK_RET( !m_font.IsNull(), wxT("wxGDIPlusContext::GetTextExtent - no valid font set") );
wxWCharBuffer s = str.wc_str( *wxConvUI );
FontFamily ffamily ;
Font* f = ((wxGDIPlusFontData*)m_font.GetRefData())->GetGDIPlusFont();
@@ -1270,6 +1274,8 @@ void wxGDIPlusContext::GetPartialTextExtents(const wxString& text, wxArrayDouble
widths.Empty();
widths.Add(0, text.length());
wxCHECK_RET( !m_font.IsNull(), wxT("wxGDIPlusContext::GetPartialTextExtents - no valid font set") );
if (text.empty())
return;