From 4927c8c6923991ae68db21e66749c1fb99240b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Mon, 8 Aug 2022 15:03:22 +0200 Subject: Don't crash on orphan URIs --- fiv.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'fiv.c') diff --git a/fiv.c b/fiv.c index 9d814ab..449d113 100644 --- a/fiv.c +++ b/fiv.c @@ -634,7 +634,11 @@ switch_to_view(void) static gchar * parent_uri(GFile *child_file) { + // The empty URI results in a convenient dummy GFile implementation. GFile *parent = g_file_get_parent(child_file); + if (!parent) + return g_strdup(""); + gchar *parent_uri = g_file_get_uri(parent); g_object_unref(parent); return parent_uri; -- cgit v1.2.3