From 536da7a15c1737bc63c8ecba5ccac40cc2170860 Mon Sep 17 00:00:00 2001
From: Matthias Clasen <mclasen@redhat.com>
Date: Mon, 19 Apr 2021 16:39:53 -0400
Subject: [PATCH] Fix a possible crash in gtk_show_uri

g_file_get_basename can return NULL.
Deal with it somehow.

Fixes: #3883
---
 gdk/x11/gdkapplaunchcontext-x11.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdk/x11/gdkapplaunchcontext-x11.c b/gdk/x11/gdkapplaunchcontext-x11.c
index 8051229ba5..2341bb2e1f 100644
--- a/gdk/x11/gdkapplaunchcontext-x11.c
+++ b/gdk/x11/gdkapplaunchcontext-x11.c
@@ -45,6 +45,9 @@ get_display_name (GFile     *file,
   if (name == NULL)
     {
       name = g_file_get_basename (file);
+      if (name == NULL)
+        name = g_file_get_uri (file);
+
       if (!g_utf8_validate (name, -1, NULL))
         {
           tmp = name;
-- 
GitLab

