NULL-check exception in sokoke_js_script_eval

This commit is contained in:
Christian Dywan 2009-11-12 23:48:19 +01:00
parent 55e50e20b1
commit 2fc6a2be89
2 changed files with 3 additions and 3 deletions

View file

@ -191,7 +191,6 @@ formhistory_navigation_decision_cb (WebKitWebView* web_view,
WebKitWebPolicyDecision* decision, WebKitWebPolicyDecision* decision,
MidoriExtension* extension) MidoriExtension* extension)
{ {
gchar* exception;
JSContextRef js_context = webkit_web_frame_get_global_context (web_frame); JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
/* The script returns form data in the form "field_name|,|value|,|field_type". /* The script returns form data in the form "field_name|,|value|,|field_type".
We are handling only input fields with 'text' or 'password' type. We are handling only input fields with 'text' or 'password' type.
@ -214,7 +213,7 @@ formhistory_navigation_decision_cb (WebKitWebView* web_view,
if (webkit_web_navigation_action_get_reason (action) == WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED if (webkit_web_navigation_action_get_reason (action) == WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED
|| webkit_web_navigation_action_get_reason (action) == WEBKIT_WEB_NAVIGATION_REASON_FORM_RESUBMITTED) || webkit_web_navigation_action_get_reason (action) == WEBKIT_WEB_NAVIGATION_REASON_FORM_RESUBMITTED)
{ {
gchar* value = sokoke_js_script_eval (js_context, script, &exception); gchar* value = sokoke_js_script_eval (js_context, script, NULL);
if (value) if (value)
{ {
gpointer db = g_object_get_data (G_OBJECT (extension), "formhistory-db"); gpointer db = g_object_get_data (G_OBJECT (extension), "formhistory-db");

View file

@ -73,7 +73,8 @@ sokoke_js_script_eval (JSContextRef js_context,
{ {
JSStringRef js_message = JSValueToStringCopy (js_context, JSStringRef js_message = JSValueToStringCopy (js_context,
js_exception, NULL); js_exception, NULL);
*exception = sokoke_js_string_utf8 (js_message); if (exception)
*exception = sokoke_js_string_utf8 (js_message);
JSStringRelease (js_message); JSStringRelease (js_message);
js_value = JSValueMakeNull (js_context); js_value = JSValueMakeNull (js_context);
} }