Fix segfault when using the 'set' command with no arguments

darcs-hash:20060502162830-ac50b-d3ab63c29a6daeaa62803923b060ec69942911f8.gz
This commit is contained in:
axel 2006-05-03 02:28:30 +10:00
parent d690a15b29
commit 92fde30c0c
4 changed files with 11 additions and 3 deletions

View File

@ -491,7 +491,7 @@ int builtin_set( wchar_t **argv )
al_push(&values, argv[woptind++]);
}
if( is_path_variable( dest ) )
if( dest && is_path_variable( dest ) )
{
int i;
int error = 0;

View File

@ -495,6 +495,12 @@ int contains_str( const wchar_t *a, ... )
wchar_t *arg;
va_list va;
int res = 0;
if( !a )
{
debug( 1, L"Warning: Called contains_str with null argument. This is a bug." );
return 0;
}
va_start( va, a );
while( (arg=va_arg(va, wchar_t *) )!= 0 )

View File

@ -181,9 +181,11 @@ void error_reset();
const wchar_t *wsetlocale( int category, const wchar_t *locale );
/**
Checks if \c needle is included in the list of strings specified
Checks if \c needle is included in the list of strings specified. A warning is printed if needle is zero.
\param needle the string to search for in the list
\return zero is needle is not found, of if needle is null, non-zero otherwise
*/
int contains_str( const wchar_t *needle, ... );

View File

@ -6,7 +6,7 @@
#include <stdarg.h>
#include <wctype.h>
#include <wchar.h>
#include "common.h"
/**
Under curses, tputs expects an int (*func)(char) as its last