summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2012-09-14 16:50:30 -0400
committerCosimo Cecchi <cosimoc@gnome.org>2012-09-14 16:57:14 -0400
commit75e219ebfdd3e32e9e421fe1a11b7f946693787e (patch)
tree69c530f0076be2af72f47b2a69ea700b9d5e2a43
parent791b256e0a1f7c03416dda2415ec4e8a07413ef8 (diff)
downloadnautilus-75e219ebfdd3e32e9e421fe1a11b7f946693787e.tar.gz
search-hit: guard against g_filename_from_uri() return NULL
-rw-r--r--libnautilus-private/nautilus-search-hit.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/libnautilus-private/nautilus-search-hit.c b/libnautilus-private/nautilus-search-hit.c
index 7e7d8f119..1eee49e93 100644
--- a/libnautilus-private/nautilus-search-hit.c
+++ b/libnautilus-private/nautilus-search-hit.c
@@ -72,20 +72,22 @@ nautilus_search_hit_compute_scores (NautilusSearchHit *hit,
guint dir_count;
hit_path = g_filename_from_uri (hit->details->uri, NULL, NULL);
- hit_parent = g_path_get_dirname (hit_path);
- g_free (hit_path);
-
- dir_count = 0;
- for (i = strlen (query_path); hit_parent[i] != '\0'; i++) {
- if (G_IS_DIR_SEPARATOR (hit_parent[i]))
- dir_count++;
- }
- g_free (hit_parent);
-
- if (dir_count < 10) {
- proximity_bonus = 100.0 - 10 * dir_count;
- } else {
- proximity_bonus = 0.0;
+ if (hit_path != NULL) {
+ hit_parent = g_path_get_dirname (hit_path);
+ g_free (hit_path);
+
+ dir_count = 0;
+ for (i = strlen (query_path); hit_parent[i] != '\0'; i++) {
+ if (G_IS_DIR_SEPARATOR (hit_parent[i]))
+ dir_count++;
+ }
+ g_free (hit_parent);
+
+ if (dir_count < 10) {
+ proximity_bonus = 100.0 - 10 * dir_count;
+ } else {
+ proximity_bonus = 0.0;
+ }
}
}
g_free (query_path);