guarding all text methods against unset font

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54919 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2008-08-02 06:40:21 +00:00
parent da712b51d4
commit 1011fbebdb
3 changed files with 20 additions and 8 deletions

View File

@@ -1400,7 +1400,9 @@ void wxCairoContext::DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDou
void wxCairoContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
{
if ( m_font.IsNull() || str.empty())
wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::DrawText - no valid font set") );
if ( str.empty())
return;
#ifdef __WXGTK__
@@ -1433,6 +1435,8 @@ void wxCairoContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height,
wxDouble *descent, wxDouble *externalLeading ) const
{
wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::GetTextExtent - no valid font set") );
if ( width )
*width = 0;
if ( height )
@@ -1442,7 +1446,7 @@ void wxCairoContext::GetTextExtent( const wxString &str, wxDouble *width, wxDoub
if ( externalLeading )
*externalLeading = 0;
if ( m_font.IsNull() || str.empty())
if ( str.empty())
return;
#ifdef __WXGTK__
@@ -1511,6 +1515,8 @@ void wxCairoContext::GetPartialTextExtents(const wxString& text, wxArrayDouble&
widths.Empty();
widths.Add(0, text.length());
wxCHECK_RET( !m_font.IsNull(), wxT("wxCairoContext::GetPartialTextExtents - no valid font set") );
if (text.empty())
return;