diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index 02533dc..d163b25 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -271,9 +271,11 @@ form_submitted_cb (WebKitDOMHTMLFormElement *dom_form,
   if (!ephy_web_dom_utils_find_form_auth_elements (dom_form, &username_node, &password_node))
     return TRUE;
 
-  g_object_get (username_node,
-                "value", &username_field_value,
-                NULL);
+  if (username_node) {
+    g_object_get (username_node,
+                  "value", &username_field_value,
+                  NULL);
+  }
 
   /* EphyEmbedFormAuth takes ownership of the nodes */
   form_auth = ephy_embed_form_auth_new (web_page, username_node, password_node, username_field_value);
@@ -356,6 +358,7 @@ pre_fill_form (EphyEmbedFormAuth *form_auth)
   SoupURI *uri;
   char *uri_str;
   char *username;
+  WebKitDOMNode *username_node;
 
   uri = ephy_embed_form_auth_get_uri (form_auth);
   if (!uri)
@@ -369,12 +372,14 @@ pre_fill_form (EphyEmbedFormAuth *form_auth)
   form_data = (EphyFormAuthData *)l->data;
   uri_str = soup_uri_to_string (uri, FALSE);
 
-  g_object_get (ephy_embed_form_auth_get_username_node (form_auth),
-                "value", &username,
-                NULL);
+  username_node = ephy_embed_form_auth_get_username_node (form_auth);
+  if (username_node)
+    g_object_get (username_node, "value", &username, NULL);
+  else
+    username = NULL;
 
   /* The username node is empty, so pre-fill with the default. */
-  if (g_str_equal (username, ""))
+  if (username != NULL && g_str_equal (username, ""))
     g_clear_pointer (&username, g_free);
 
   ephy_form_auth_data_query (uri_str,
@@ -877,9 +882,11 @@ web_page_document_loaded (WebKitWebPage *web_page,
       webkit_dom_event_target_add_event_listener (WEBKIT_DOM_EVENT_TARGET (form), "submit",
                                                   G_CALLBACK (form_submitted_cb), FALSE,
                                                   web_page);
-      webkit_dom_event_target_add_event_listener (WEBKIT_DOM_EVENT_TARGET (username_node), "blur",
-                                                  G_CALLBACK (username_changed_cb), FALSE,
-                                                  form_auth);
+      if (username_node) {
+        webkit_dom_event_target_add_event_listener (WEBKIT_DOM_EVENT_TARGET (username_node), "blur",
+                                                    G_CALLBACK (username_changed_cb), FALSE,
+                                                    form_auth);
+      }
 
       /* Plug in the user autocomplete */
       uri_string = webkit_web_page_get_uri (web_page);
@@ -889,7 +896,7 @@ web_page_document_loaded (WebKitWebPage *web_page,
 
       soup_uri_free (uri);
 
-      if (auth_data_list && auth_data_list->next) {
+      if (auth_data_list && auth_data_list->next && username_node) {
         LOG ("More than 1 password saved, hooking menu for choosing which on focus");
         g_object_set_data (G_OBJECT (username_node), "ephy-auth-data-list", auth_data_list);
         g_object_set_data (G_OBJECT (username_node), "ephy-form-auth", form_auth);
diff --git a/lib/ephy-form-auth-data.c b/lib/ephy-form-auth-data.c
index 29d55c8..f3888aa 100644
--- a/lib/ephy-form-auth-data.c
+++ b/lib/ephy-form-auth-data.c
@@ -125,7 +125,7 @@ ephy_form_auth_data_store (const char *uri,
   value = secret_value_new (password, -1, "text/plain");
   attributes = ephy_form_auth_data_get_secret_attributes_table (fake_uri_str, form_username,
                                                                 form_password, username);
-  if (username == NULL) {
+  if (username != NULL) {
     /* Translators: The first %s is the username and the second one is the
      * hostname where this is happening. Example: gnome@gmail.com and
      * mail.google.com.
