From 70b85bf6009427751b8caa15867fe6488eddd7f8 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Tue, 28 Feb 2012 23:51:31 +0100 Subject: [PATCH] Skip site data rule policy check on empty rules --- midori/midori-websettings.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c index f8d63793..910a4bab 100644 --- a/midori/midori-websettings.c +++ b/midori/midori-websettings.c @@ -1238,6 +1238,15 @@ MidoriSiteDataPolicy midori_web_settings_get_site_data_policy (MidoriWebSettings* settings, const gchar* uri) { + MidoriSiteDataPolicy policy = MIDORI_SITE_DATA_UNDETERMINED; + gchar* hostname; + const gchar* match; + + g_return_val_if_fail (MIDORI_IS_WEB_SETTINGS (settings), policy); + + if (!(settings->site_data_rules && *settings->site_data_rules)) + return policy; + /* * Values prefixed with "-" are always blocked * Values prefixed with "+" are always accepted @@ -1246,9 +1255,8 @@ midori_web_settings_get_site_data_policy (MidoriWebSettings* settings, * FIXME: indicate type of storage the rule applies to * FIXME: support matching of the whole URI **/ - MidoriSiteDataPolicy policy = MIDORI_SITE_DATA_UNDETERMINED; - gchar* hostname = midori_uri_parse_hostname (uri, NULL); - const gchar* match = strstr (settings->site_data_rules, hostname ? hostname : uri); + hostname = midori_uri_parse_hostname (uri, NULL); + match = strstr (settings->site_data_rules, hostname ? hostname : uri); if (match != NULL && match != settings->site_data_rules) { const gchar* prefix = match - 1;