[epiphany/gnome-3-36] Assert webapp is non-NULL where required
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/gnome-3-36] Assert webapp is non-NULL where required
- Date: Thu, 30 Apr 2020 17:33:23 +0000 (UTC)
commit 725a46e31d84c361fa959031ed4499c6bf700b82
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Wed Apr 29 22:23:06 2020 +0000
Assert webapp is non-NULL where required
ephy_web_application_for_profile_directory() had better not return NULL
if called for the current profile directory in app mode. In this case,
we should crash as cleanly as possible, with g_assert().
But in other situatitons, it's OK for this function to return NULL.
Other callers are already prepared to handle this.
(cherry picked from commit 700cec9ae69c0e9ba28d5fdf45b0fd56d6e697ff)
lib/ephy-web-app-utils.c | 2 ++
src/prefs-dialog.c | 1 +
2 files changed, 3 insertions(+)
---
diff --git a/lib/ephy-web-app-utils.c b/lib/ephy-web-app-utils.c
index 92bb16432..a3a24615a 100644
--- a/lib/ephy-web-app-utils.c
+++ b/lib/ephy-web-app-utils.c
@@ -786,6 +786,8 @@ ephy_web_application_is_uri_allowed (const char *uri)
guint i;
gboolean matched = FALSE;
+ g_assert (webapp);
+
if (g_str_has_prefix (uri, "blob:") || g_str_has_prefix (uri, "data:"))
return TRUE;
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 02805bc5a..fa2dc6d03 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -2082,6 +2082,7 @@ setup_general_page (PrefsDialog *dialog)
if (ephy_embed_shell_get_mode (ephy_embed_shell_get_default ()) == EPHY_EMBED_SHELL_MODE_APPLICATION) {
dialog->webapp = ephy_web_application_for_profile_directory (ephy_profile_dir ());
+ g_assert (dialog->webapp);
prefs_dialog_update_webapp_icon (dialog, dialog->webapp->icon_url);
gtk_entry_set_text (GTK_ENTRY (dialog->webapp_url), dialog->webapp->url);
gtk_entry_set_text (GTK_ENTRY (dialog->webapp_title), dialog->webapp->name);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]