From: Stefan Csomor Date: Thu, 29 Jun 2006 08:16:49 +0000 (+0000) Subject: fix for potential crash when conversion fails X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a0ef88bde8e4e0b9f6268b9b0001eb6b6beca708?hp=1ae82ba9f23ee688bc4db2cd449eca5bf97cfdf0 fix for potential crash when conversion fails git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39886 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/dc.cpp b/src/mac/carbon/dc.cpp index eb8b35a402..443bcdbb8b 100644 --- a/src/mac/carbon/dc.cpp +++ b/src/mac/carbon/dc.cpp @@ -1782,17 +1782,25 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con #endif { wxCharBuffer buff = text.mb_str(wxConvLocal); - size_t len = strlen(buff); - short* measurements = new short[len+1]; - MeasureText(len, buff.data(), measurements); + if ( buff.data() == 0 ) + { + for (size_t i=0; i