X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3f66f6a5b3583b02c34854556eb83e3a808524ce..bddab017c6c78f1dab68745a532996bab37f3ee8:/src/generic/dcpsg.cpp diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index d14255fd08..b5c493b0f4 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -1659,7 +1659,7 @@ void wxPostScriptDCImpl::ComputeScaleAndOrigin() wxDCImpl::ComputeScaleAndOrigin(); - // If scale has changed call SetPen to recalulate the line width + // If scale has changed call SetPen to recalculate the line width // and SetFont to recalculate font size if ( wxRealPoint(m_scaleX, m_scaleY) != origScale && m_pen.IsOk() ) { @@ -2339,8 +2339,20 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string, long sum=0; float height=fontSize; /* by default */ - unsigned char *p; - for(p=(unsigned char *)wxMBSTRINGCAST strbuf; *p; p++) + unsigned char *p=(unsigned char *)wxMBSTRINGCAST strbuf; + if(!p) + { + // String couldn't be converted which used to SEGV as reported here: + // http://bugs.debian.org/702378 + // http://trac.wxwidgets.org/ticket/15300 + // Upstream suggests "just return if the conversion failed". + if (x) (*x) = 0; + if (y) (*y) = 0; + if (descent) (*descent) = 0; + if (externalLeading) (*externalLeading) = 0; + return; + } + for(; *p; p++) { if(lastWidths[*p]== INT_MIN) {