[gtk/wip/hadess/fix-remote-filechooser: 1/2] filechooser: Fix crash when file has no content-type
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/hadess/fix-remote-filechooser: 1/2] filechooser: Fix crash when file has no content-type
- Date: Fri, 28 Feb 2020 16:02:53 +0000 (UTC)
commit 22b0400f5edfad7974d42f1a064b65c52f16a46a
Author: Bastien Nocera <hadess hadess net>
Date: Fri Feb 28 16:56:29 2020 +0100
filechooser: Fix crash when file has no content-type
This might happen for slow filesystems where a fast-content-type might
be provided instead. Don't try to manipulate that content_type if it's
NULL, otherwise we'll either throw warnings (at best) or crash (at
worse).
gtk/gtkfilechooserwidget.c | 4 ++++
1 file changed, 4 insertions(+)
---
diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c
index 9c7aadb8fd..2e9832524c 100644
--- a/gtk/gtkfilechooserwidget.c
+++ b/gtk/gtkfilechooserwidget.c
@@ -5049,6 +5049,9 @@ get_type_information (GtkFileChooserWidget *impl,
char *description;
content_type = g_file_info_get_content_type (info);
+ if (!content_type)
+ goto end;
+
switch (impl->priv->type_format)
{
case TYPE_FORMAT_MIME:
@@ -5066,6 +5069,7 @@ get_type_information (GtkFileChooserWidget *impl,
g_assert_not_reached ();
}
+end:
return g_strdup ("");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]