wxOSX: don't call strlen() on possibly null pointer.
Use wxCharBuffer::length() instead, this is more efficient and safer as it correctly returns 0 in case the conversion fails. Closes #9967.
This commit is contained in:
@@ -264,7 +264,7 @@ CGColorRef wxMacCreateCGColorFromHITheme( ThemeBrush brush )
|
|||||||
void wxMacStringToPascal( const wxString&from , unsigned char * to )
|
void wxMacStringToPascal( const wxString&from , unsigned char * to )
|
||||||
{
|
{
|
||||||
wxCharBuffer buf = from.mb_str( wxConvLocal );
|
wxCharBuffer buf = from.mb_str( wxConvLocal );
|
||||||
int len = strlen(buf);
|
size_t len = buf.length();
|
||||||
|
|
||||||
if ( len > 255 )
|
if ( len > 255 )
|
||||||
len = 255;
|
len = 255;
|
||||||
|
Reference in New Issue
Block a user