From 5a670e2a960987a8b1962fbde0c038f743041261 Mon Sep 17 00:00:00 2001 From: axel Date: Wed, 11 Apr 2007 23:18:23 +1000 Subject: [PATCH] Fix bug where fish would refuse to start if $HOME has an invalid value. Thanks to James Vega for the report. darcs-hash:20070411131823-ac50b-2760c09e8939179a6c771a44220aa355381f4f0b.gz --- main.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 57556e3e8..c9034eaab 100644 --- a/main.c +++ b/main.c @@ -94,12 +94,20 @@ static int read_init() context = halloc( 0, 0 ); eval_buff = sb_halloc( context ); config_dir = path_get_config( context ); - config_dir_escaped = escape( config_dir, 1 ); - sb_printf( eval_buff, L"builtin cd %ls 2>/dev/null; and builtin . config.fish 2>/dev/null", config_dir_escaped ); - eval( (wchar_t *)eval_buff->buff, 0, TOP ); + + /* + If config_dir is null then we have no configuration directory + and no custom config to load. + */ + if( config_dir ) + { + config_dir_escaped = escape( config_dir, 1 ); + sb_printf( eval_buff, L"builtin cd %ls 2>/dev/null; and builtin . config.fish 2>/dev/null", config_dir_escaped ); + eval( (wchar_t *)eval_buff->buff, 0, TOP ); + free( config_dir_escaped ); + } halloc_free( context ); - free( config_dir_escaped ); if( wchdir( cwd ) == -1 ) { @@ -301,7 +309,6 @@ int main( int argc, char **argv ) no_exec = 0; } - proc_init(); event_init(); wutil_init();