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

@@ -1941,8 +1941,7 @@ void wxMacCoreGraphicsContext::PopState()
void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
{
if ( m_font.IsNull() )
return;
wxCHECK_RET( !m_font.IsNull(), wxT("wxMacCoreGraphicsContext::DrawText - no valid font set") );
EnsureIsValid();
#if wxOSX_USE_CORE_TEXT
@@ -1998,8 +1997,7 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle )
{
if ( m_font.IsNull() )
return;
wxCHECK_RET( !m_font.IsNull(), wxT("wxMacCoreGraphicsContext::DrawText - no valid font set") );
EnsureIsValid();
#if wxOSX_USE_CORE_TEXT
@@ -2103,7 +2101,7 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height,
wxDouble *descent, wxDouble *externalLeading ) const
{
wxCHECK_RET( !m_font.IsNull(), wxT("wxDC(cg)::DoGetTextExtent - no valid font set") );
wxCHECK_RET( !m_font.IsNull(), wxT("wxMacCoreGraphicsContext::GetTextExtent - no valid font set") );
if ( width )
*width = 0;
@@ -2207,6 +2205,8 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
widths.Empty();
widths.Add(0, text.length());
wxCHECK_RET( !m_font.IsNull(), wxT("wxMacCoreGraphicsContext::DrawText - no valid font set") );
if (text.empty())
return;