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
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)
{