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




commit 3163e9a23cfa0fc75a118ed7ec7c99c0e4212a50
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]