diff --git a/highlight.cpp b/highlight.cpp index acc7f6886..3467f9b80 100644 --- a/highlight.cpp +++ b/highlight.cpp @@ -190,19 +190,24 @@ int highlight_get_color( int highlight ) } } - wchar_t *val = env_get( highlight_var[idx]); + wcstring val_wstr = env_get_string( highlight_var[idx]); + const wchar_t *val = val_wstr.empty()?NULL:val_wstr.c_str(); // debug( 1, L"%d -> %d -> %ls", highlight, idx, val ); - if( val == 0 ) - val = env_get( highlight_var[0]); + if( val == 0 ) { + val_wstr = env_get_string( highlight_var[0]); + val = val_wstr.empty()?NULL:val_wstr.c_str(); + } if( val ) result = output_color_code( val ); if( highlight & HIGHLIGHT_VALID_PATH ) { - wchar_t *val2 = env_get( L"fish_color_valid_path" ); + wcstring val2_wstr = env_get_string( L"fish_color_valid_path" ); + const wchar_t *val2 = val2_wstr.empty()?NULL:val2_wstr.c_str(); + int result2 = output_color_code( val2 ); if( result == FISH_COLOR_NORMAL ) result = result2;