Check that g_utf8_normalize was non-NULL, fallback otherwise

This commit is contained in:
Christian Dywan 2009-12-27 22:18:02 +01:00
parent 33565cc2f3
commit 8b7fdb7a56

View file

@ -755,21 +755,42 @@ midori_location_entry_completion_match_cb (GtkEntryCompletion* completion,
match = FALSE;
if (G_LIKELY (uri))
{
gchar* nkey = g_utf8_normalize (key, -1, G_NORMALIZE_ALL);
gchar* nuri = g_utf8_normalize (uri, -1, G_NORMALIZE_ALL);
gchar* fkey = g_utf8_casefold (nkey, -1);
gchar* furi = g_utf8_casefold (nuri, -1);
g_free (uri);
gchar* nkey;
gchar* fkey;
gchar* nuri;
gchar* furi;
if ((nkey = g_utf8_normalize (key, -1, G_NORMALIZE_ALL)))
{
fkey = g_utf8_casefold (nkey, -1);
g_free (nkey);
}
else
fkey = g_utf8_casefold (key, -1);
if ((nuri = g_utf8_normalize (uri, -1, G_NORMALIZE_ALL)))
{
furi = g_utf8_casefold (nuri, -1);
g_free (nuri);
}
else
furi = g_utf8_casefold (uri, -1);
g_free (uri);
match = strstr (furi, fkey) != NULL;
g_free (furi);
if (!match && G_LIKELY (title))
{
gchar* ntitle = g_utf8_normalize (title, -1, G_NORMALIZE_ALL);
gchar* ftitle = g_utf8_casefold (ntitle, -1);
gchar* ntitle;
gchar* ftitle;
if ((ntitle = g_utf8_normalize (title, -1, G_NORMALIZE_ALL)))
{
ftitle = g_utf8_casefold (ntitle, -1);
g_free (ntitle);
}
else
ftitle = g_utf8_casefold (title, -1);
match = strstr (ftitle, fkey) != NULL;
g_free (ftitle);
}