From: robertl Date: Sun, 17 Oct 2004 01:20:02 +0000 (+0000) Subject: Let str_utf8_to_ascii not crash if given NULL input. X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~11^2~3895 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=71fa5c3fd780049efe46aeaac8b9fcb8f32ab10c;p=gpsbabel.git Let str_utf8_to_ascii not crash if given NULL input. --- diff --git a/gpsbabel/util.c b/gpsbabel/util.c index 32d54baeb..975b7598f 100644 --- a/gpsbabel/util.c +++ b/gpsbabel/util.c @@ -785,8 +785,13 @@ char * str_utf8_to_cp1252( const char * str ) char * str_utf8_to_ascii( const char * str ) { - char *result = xstrdup( str ); - char *cur = result; + char *result; + char *cur; + + if (!str) return NULL; + + result = xstrdup( str ); + cur = result; while ( cur && *cur ) { if ( *cur & 0x80 ) {