Add check if userdata is null

This commit is contained in:
jun7 2017-07-18 11:12:33 +09:00
parent f8ffb947aa
commit a406081443

View File

@ -987,14 +987,17 @@ G_MODULE_EXPORT void webkit_web_extension_initialize_with_user_data(
WebKitWebExtension *ex, const GVariant *v) WebKitWebExtension *ex, const GVariant *v)
{ {
bool enable = true; bool enable = true;
const gchar *str = g_variant_get_string((GVariant *)v, NULL); if (v)
if (str)
{ {
gchar **args = g_strsplit(str, ";", -1); const gchar *str = g_variant_get_string((GVariant *)v, NULL);
for (gchar **arg = args; *arg; arg++) if (str)
if (g_str_has_prefix(*arg, "adblock:")) {
enable = strcmp(*arg + 8, "true") == 0; gchar **args = g_strsplit(str, ";", -1);
g_strfreev(args); for (gchar **arg = args; *arg; arg++)
if (g_str_has_prefix(*arg, "adblock:"))
enable = strcmp(*arg + 8, "true") == 0;
g_strfreev(args);
}
} }
if (enable) if (enable)