From a0ef88bde8e4e0b9f6268b9b0001eb6b6beca708 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 29 Jun 2006 08:16:49 +0000 Subject: [PATCH] fix for potential crash when conversion fails git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39886 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/dc.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) 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