[nautilus/wip/corey/properties: 37/44] properties: Don't attempt to setup_star if parent_location == NULL




commit 808a4054aea895edaeb7339a6559995fd2310ad8
Author: Corey Berla <corey berla me>
Date:   Tue Aug 23 09:45:57 2022 -0700

    properties: Don't attempt to setup_star if parent_location == NULL
    
    When you open a properties window on the root file system,
    you'll get
    g_file_has_prefix: assertion 'G_IS_FILE (file)' failed
    because setup_star is checking if the parent location can be starred.
    We only allow starring files in the home directory anyways, so just
    return early
    
    Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2422

 src/nautilus-properties-window.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index af8c2d8bb..8c2c21152 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -804,6 +804,11 @@ setup_star_button (NautilusPropertiesWindow *self)
     NautilusFile *file = get_target_file (self);
     g_autoptr (GFile) parent_location = nautilus_file_get_parent_location (file);
 
+    if (parent_location == NULL)
+    {
+        return;
+    }
+
     if (nautilus_tag_manager_can_star_contents (tag_manager, parent_location))
     {
         gtk_widget_show (self->star_button);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]