X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2894667fa4e04628bcb3cae98a3dbd9cb80593ea..a5e3c24d7b0b954b0408697a211d004e4a55051d:/src/cocoa/dc.mm?ds=sidebyside 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];