Skip to content

Commit

Permalink
Fix segfault when using the 'set' command with no arguments
Browse files Browse the repository at this point in the history
darcs-hash:20060502162830-ac50b-d3ab63c29a6daeaa62803923b060ec69942911f8.gz
  • Loading branch information
liljencrantz committed May 2, 2006
1 parent d690a15 commit 92fde30
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion builtin_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
4 changes: 3 additions & 1 deletion common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, ... );

Expand Down
2 changes: 1 addition & 1 deletion fallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 92fde30

Please sign in to comment.