From c0fce75798460fd00ae9f84bf4c9613558ee9324 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Tue, 7 Jun 2005 21:58:17 +0000 Subject: [project @ 2005-06-07 21:58:17 by jmb] Fix stupid assertions. svn path=/import/netsurf/; revision=1745 --- desktop/browser.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'desktop') diff --git a/desktop/browser.c b/desktop/browser.c index 13ca3cab9..e65fa38c6 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -489,10 +489,19 @@ void browser_window_update(struct browser_window *bw, if (bw->current_content->title != NULL) { err = utf8_to_enc(bw->current_content->title, local_encoding_name(), 0, &title_local_enc); - /* this should never fail */ - assert(err == UTF8_CONVERT_OK); - gui_window_set_title(bw->window, title_local_enc); - free(title_local_enc); + if (err != UTF8_CONVERT_OK) { + /* A bad encoding should never happen, + * so assert this */ + assert(err != UTF8_CONVERT_BADENC); + LOG(("utf8_to_enc failed")); + /* use utf-8 encoded title instead */ + gui_window_set_title(bw->window, + bw->current_content->title); + } + else { + gui_window_set_title(bw->window, title_local_enc); + free(title_local_enc); + } } else gui_window_set_title(bw->window, bw->current_content->url); -- cgit v1.2.3