[nautilus] Prevent a crash in nautilus_file_peek_display_name() on invalid NautilusFile



commit 8f6245a80cfd571274813fe4d5d950769d02bfba
Author: Tomas Bzatek <tbzatek redhat com>
Date:   Thu Jan 27 11:22:10 2011 +0100

    Prevent a crash in nautilus_file_peek_display_name() on invalid NautilusFile
    
    This is more a workaround only, expect assert failures at other
    places when something bad happens. There's a race condition somewhere,
    this patch only prevents immediate crash.
    
    Patch by Marcus Husar <marcus husar rose uni-heidelberg de>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=602500

 libnautilus-private/nautilus-file.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 8951776..a1b738a 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -3669,6 +3669,9 @@ nautilus_file_peek_display_name (NautilusFile *file)
 	const char *name;
 	char *escaped_name;
 
+	if (file == NULL || nautilus_file_is_gone (file))
+		return "";
+
 	/* Default to display name based on filename if its not set yet */
 	
 	if (file->details->display_name == NULL) {



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