summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2023-03-08 13:21:55 +0100
committerOndrej Holy <oholy@redhat.com>2023-03-09 14:06:07 +0000
commiteb8103876eeb4fe4d163aaf41a80b27e0bd79797 (patch)
treec11f7145b4703e4a6d912d1f4cdc9105cf061d43
parent6dcfe48857f0e9574cc4066b296391c6f806260a (diff)
downloadnautilus-eb8103876eeb4fe4d163aaf41a80b27e0bd79797.tar.gz
search-engine-simple: Handle case when mime type is NULL
The `G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE` attribute doesn't have to be always set. This case is not handled by the `NautilusSearchEngineSimple` class and the `NULL` pointer can be passed in the `g_content_type_is_a` function currently. This is an error. Let's check the returned pointer to prevent this situation.
-rw-r--r--src/nautilus-search-engine-simple.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nautilus-search-engine-simple.c b/src/nautilus-search-engine-simple.c
index 4dcd12b4e..41c567c4b 100644
--- a/src/nautilus-search-engine-simple.c
+++ b/src/nautilus-search-engine-simple.c
@@ -349,7 +349,7 @@ visit_directory (GFile *dir,
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
found = FALSE;
- for (gint i = 0; i < data->mime_types->len; i++)
+ for (gint i = 0; mime_type != NULL && i < data->mime_types->len; i++)
{
if (g_content_type_is_a (mime_type, g_ptr_array_index (data->mime_types, i)))
{