[epiphany] WebExtensions: Confirm that accelerator is not null
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] WebExtensions: Confirm that accelerator is not null
- Date: Tue, 12 Jul 2022 15:56:13 +0000 (UTC)
commit f7e21da94149bce143de8f6bc1e22e1c23965946
Author: Jamie Murphy <hello itsjamie dev>
Date: Tue Jul 12 08:13:20 2022 -0700
WebExtensions: Confirm that accelerator is not null
Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1172>
src/webextension/api/commands.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/src/webextension/api/commands.c b/src/webextension/api/commands.c
index 4316dc77b..336f7f904 100644
--- a/src/webextension/api/commands.c
+++ b/src/webextension/api/commands.c
@@ -73,9 +73,17 @@ void
set_accel_for_action (EphyWebExtension *self,
WebExtensionCommand *command)
{
- g_auto (GStrv) current_actions = gtk_application_get_actions_for_accel (GTK_APPLICATION
(ephy_shell_get_default ()),
- command->accelerator);
- g_autofree char *action_name = get_accel_action_name (self, command);
+ g_auto (GStrv) current_actions = NULL;
+ g_autofree char *action_name = NULL;
+
+ if (command->accelerator == NULL) {
+ g_debug ("commands: Command has no accelerator, skipping");
+ return;
+ }
+
+ current_actions = gtk_application_get_actions_for_accel (GTK_APPLICATION (ephy_shell_get_default ()),
+ command->accelerator);
+ action_name = get_accel_action_name (self, command);
if (current_actions[0] != NULL) {
g_debug ("commands: Accelerator %s already set, not overriding", command->accelerator);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]