From 13fc3db40e66fba5d2a24e2c4e5b959d9f5fabce Mon Sep 17 00:00:00 2001 From: David Elliott Date: Mon, 7 Apr 2003 04:04:10 +0000 Subject: [PATCH] Do some sanity checks in DoDrawText to make sure we actually have some glyphs git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20055 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/cocoa/dc.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cocoa/dc.mm b/src/cocoa/dc.mm index b6c71aaca8..7b54beb590 100644 --- a/src/cocoa/dc.mm +++ b/src/cocoa/dc.mm @@ -107,7 +107,11 @@ void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y) NSRange glyphRange = [sm_cocoaNSLayoutManager glyphRangeForTextContainer:sm_cocoaNSTextContainer]; NSRect usedRect = [sm_cocoaNSLayoutManager usedRectForTextContainer:sm_cocoaNSTextContainer]; - + // NOTE: We'll crash trying to get the location of glyphAtIndex:0 if + // there is no length or we don't start at zero + if(!glyphRange.length) + return; + wxASSERT_MSG(glyphRange.location==0,"glyphRange must begin at zero"); NSAffineTransform *transform = [NSAffineTransform transform]; [transform translateXBy:x yBy:y]; -- 2.45.2