fix null reference when erase TERM env

Way to reproduce:

> set -e TERM
fish: function contains_internal called with null value for argument a.
fish: This is a bug. If you can reproduce it,  please send a bug report
to fish-users@lists.sf.net.
fish: Backtrace:
/home/grissiom/sysroot/bin/fish(show_stackframe+0x1a) [0x43519a]
/home/grissiom/sysroot/bin/fish(contains_internal+0xce) [0x4373ee]
/home/grissiom/sysroot/bin/fish(reader_write_title+0x59) [0x424179]
/home/grissiom/sysroot/bin/fish() [0x4242d5]
/home/grissiom/sysroot/bin/fish(reader_readline+0x54) [0x425974]
/home/grissiom/sysroot/bin/fish(reader_read+0xba) [0x42742a]
/home/grissiom/sysroot/bin/fish(main+0x4be) [0x43b19e]
/lib64/libc.so.6(__libc_start_main+0xfd) [0x7fcbe0dcbb6d]
/home/grissiom/sysroot/bin/fish() [0x408c29]
This commit is contained in:
Grissiom 2010-10-06 20:58:13 +08:00
parent 89d999df72
commit 6654fff377

View file

@ -624,10 +624,16 @@ void reader_write_title()
don't. Since we can't see the underlying terminal below screen
there is no way to fix this.
*/
if( !term || !contains( term, L"xterm", L"screen", L"nxterm", L"rxvt" ) )
if ( !term )
{
return;
}
if( !contains( term, L"xterm", L"screen", L"nxterm", L"rxvt" ) )
{
char *n = ttyname( STDIN_FILENO );
if( contains( term, L"linux" ) )
{
return;
@ -641,7 +647,7 @@ void reader_write_title()
title = function_exists( L"fish_title" )?L"fish_title":DEFAULT_TITLE;
if( wcslen( title ) ==0 )
if( wcslen( title ) == 0 )
return;
al_init( &l );