Commit 9f1f7af1 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Handle NULL pointer properly in Unicode conversion thingy

parent 53d6bb5d
...@@ -1891,6 +1891,9 @@ char *FromLocale( const char *locale ) ...@@ -1891,6 +1891,9 @@ char *FromLocale( const char *locale )
{ {
char *psz_charset; char *psz_charset;
if( locale == NULL )
return NULL;
if( !vlc_current_charset( &psz_charset ) ) if( !vlc_current_charset( &psz_charset ) )
{ {
char *iptr = (ICONV_CONST char *)locale, *output, *optr; char *iptr = (ICONV_CONST char *)locale, *output, *optr;
...@@ -1928,6 +1931,9 @@ char *ToLocale( const char *utf8 ) ...@@ -1928,6 +1931,9 @@ char *ToLocale( const char *utf8 )
{ {
char *psz_charset; char *psz_charset;
if( utf8 == NULL )
return NULL;
if( !vlc_current_charset( &psz_charset ) ) if( !vlc_current_charset( &psz_charset ) )
{ {
char *iptr = (ICONV_CONST char *)utf8, *output, *optr; char *iptr = (ICONV_CONST char *)utf8, *output, *optr;
...@@ -1959,6 +1965,8 @@ char *ToLocale( const char *utf8 ) ...@@ -1959,6 +1965,8 @@ char *ToLocale( const char *utf8 )
void LocaleFree( const char *str ) void LocaleFree( const char *str )
{ {
if( str != NULL )
{
/* FIXME: this deserve a price for the most inefficient peice of code */ /* FIXME: this deserve a price for the most inefficient peice of code */
char *psz_charset; char *psz_charset;
...@@ -1966,6 +1974,7 @@ void LocaleFree( const char *str ) ...@@ -1966,6 +1974,7 @@ void LocaleFree( const char *str )
free( (char *)str ); free( (char *)str );
free( psz_charset ); free( psz_charset );
}
} }
/* FIXME: don't use iconv at all */ /* FIXME: don't use iconv at all */
...@@ -1975,6 +1984,9 @@ char *EnsureUTF8( char *str ) ...@@ -1975,6 +1984,9 @@ char *EnsureUTF8( char *str )
size_t inb, outb; size_t inb, outb;
char *ostr, *istr; char *ostr, *istr;
if( str == NULL )
return NULL;
ostr = istr = str; ostr = istr = str;
inb = outb = strlen( str ); inb = outb = strlen( str );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment