aboutsummaryrefslogtreecommitdiff
path: root/fiv.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-08-08 15:03:22 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-08-08 15:14:20 +0200
commit4927c8c6923991ae68db21e66749c1fb99240b08 (patch)
tree32d5f98c3b4335b4b66bfa10a5410fc31ba093ec /fiv.c
parente6341e59bbc248b84a33aef263c90d6eb97e9302 (diff)
downloadfiv-4927c8c6923991ae68db21e66749c1fb99240b08.tar.gz
fiv-4927c8c6923991ae68db21e66749c1fb99240b08.tar.xz
fiv-4927c8c6923991ae68db21e66749c1fb99240b08.zip
Don't crash on orphan URIs
Diffstat (limited to 'fiv.c')
-rw-r--r--fiv.c4
1 files changed, 4 insertions, 0 deletions
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;