Fix another crash when conversion fails in Unix PostScript code.
Returning 0 length from GetTextExtent() is hardly ideal but it's better than crashing. Closes #15489. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74786 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2339,8 +2339,20 @@ void wxPostScriptDCImpl::DoGetTextExtent(const wxString& string,
|
|||||||
|
|
||||||
long sum=0;
|
long sum=0;
|
||||||
float height=fontSize; /* by default */
|
float height=fontSize; /* by default */
|
||||||
unsigned char *p;
|
unsigned char *p=(unsigned char *)wxMBSTRINGCAST strbuf;
|
||||||
for(p=(unsigned char *)wxMBSTRINGCAST strbuf; *p; p++)
|
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)
|
if(lastWidths[*p]== INT_MIN)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user