[epiphany/mcatanzaro/#618: 1/2] Fix crash setting web app title without hostname



commit bb4dc57e154f0f4726b2af8b5b22c230e118911a
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Tue Jan 8 14:26:52 2019 -0600

    Fix crash setting web app title without hostname
    
    We probably shouldn't allow creating web apps for URIs without hostnames
    at all, but regardless, we should always check the result of
    soup_uri_get_host() because it could return NULL. Here we actually do
    that check, but don't guard enough of the code with it.
    
    Fixes #618

 src/window-commands.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/window-commands.c b/src/window-commands.c
index 7dae14056..0f479f1ef 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1177,14 +1177,15 @@ set_default_application_title (EphyApplicationDialogData *data,
     uri = soup_uri_new (webkit_web_view_get_uri (WEBKIT_WEB_VIEW (data->view)));
     host = soup_uri_get_host (uri);
 
-    if (host != NULL && host[0] != '\0')
+    if (host != NULL && host[0] != '\0') {
       title = get_special_case_application_title_for_host (host);
 
-    if (title == NULL || title[0] == '\0') {
-      if (g_str_has_prefix (host, "www."))
-        title = g_strdup (host + strlen ("www."));
-      else
-        title = g_strdup (host);
+      if (title == NULL || title[0] == '\0') {
+        if (g_str_has_prefix (host, "www."))
+          title = g_strdup (host + strlen ("www."));
+        else
+          title = g_strdup (host);
+      }
     }
 
     soup_uri_free (uri);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]