From 1ae82ba9f23ee688bc4db2cd449eca5bf97cfdf0 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 29 Jun 2006 08:07:50 +0000 Subject: [PATCH 1/1] fix for potention crash when conversion fails git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/dc.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/mac/carbon/dc.cpp b/src/mac/carbon/dc.cpp index 7140e82d7e..eb8b35a402 100644 --- a/src/mac/carbon/dc.cpp +++ b/src/mac/carbon/dc.cpp @@ -1650,7 +1650,8 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y) #endif { wxCharBuffer text = linetext.mb_str(wxConvLocal) ; - ::DrawText( text , 0 , strlen(text) ) ; + if ( text.data() != NULL ) + ::DrawText( text , 0 , strlen(text) ) ; } } @@ -1718,7 +1719,10 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *he else { wxCharBuffer text = linetext.mb_str(wxConvLocal) ; - curwidth = ::TextWidth( text , 0 , strlen(text) ) ; + if ( text.data() != NULL ) + curwidth = ::TextWidth( text , 0 , strlen(text) ) ; + else + curwidth = 0 ; } if ( curwidth > *width ) -- 2.45.2