label: Fix crashes when executing a11y actions

This commit is contained in:
Erik Schilling 2023-05-31 12:27:48 +00:00 committed by Matthias Clasen
parent f5e7a1d4cc
commit d03b27b441

View File

@ -1970,10 +1970,13 @@ gtk_label_activate_link_open (GtkWidget *widget,
GVariant *parameter) GVariant *parameter)
{ {
GtkLabel *self = GTK_LABEL (widget); GtkLabel *self = GTK_LABEL (widget);
GtkLabelLink *link = self->select_info->context_link; if (self->select_info)
{
GtkLabelLink *link = self->select_info->context_link;
if (link) if (link)
emit_activate_link (self, link); emit_activate_link (self, link);
}
} }
static void static void
@ -1982,17 +1985,18 @@ gtk_label_activate_link_copy (GtkWidget *widget,
GVariant *parameter) GVariant *parameter)
{ {
GtkLabel *self = GTK_LABEL (widget); GtkLabel *self = GTK_LABEL (widget);
GtkLabelLink *link = self->select_info->context_link; if (self->select_info)
if (link)
{ {
GdkClipboard *clipboard; GtkLabelLink *link = self->select_info->context_link;
clipboard = gtk_widget_get_clipboard (widget); if (link)
gdk_clipboard_set_text (clipboard, link->uri); {
GdkClipboard *clipboard;
clipboard = gtk_widget_get_clipboard (widget);
gdk_clipboard_set_text (clipboard, link->uri);
}
} }
else
g_print ("no link ?!\n");
} }
static void static void