From 14a3005a7c857455abe72e94034c99df6ac634c9 Mon Sep 17 00:00:00 2001 From: "cmanske%netscape.com" Date: Tue, 13 Oct 1998 20:32:21 +0000 Subject: [PATCH] Fixed crashing when setting doc title to NULL. R/A by brendon git-svn-id: svn://10.0.0.236/trunk@12718 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/lib/libmisc/shist.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mozilla/lib/libmisc/shist.c b/mozilla/lib/libmisc/shist.c index 5733bad267f..33824e52790 100644 --- a/mozilla/lib/libmisc/shist.c +++ b/mozilla/lib/libmisc/shist.c @@ -815,12 +815,15 @@ SHIST_SetTitleOfCurrentDoc( MWContext *context ) { /* StrAllocCopy( he->title, context->title ); */ /* Let's save the History as UTF8 */ - he->title = (char*)INTL_ConvertLineWithoutAutoDetect( - INTL_DefaultWinCharSetID(context), - CS_UTF8, - (unsigned char*) context->title, - XP_STRLEN(context->title) - ); + /* added by cmanske: free existing and check for null title */ + XP_FREEIF(he->title); + if( context->title ) + he->title = (char*)INTL_ConvertLineWithoutAutoDetect( + INTL_DefaultWinCharSetID(context), + CS_UTF8, + (unsigned char*) context->title, + XP_STRLEN(context->title) + ); /* * This is the place where we set the title for *global* history hash records * In addition to not making grid cells normal history entries we've added two