Commit 732cf390 authored by Christian Hergert's avatar Christian Hergert
Browse files

rust-analyzer: handle reaching / gracefully

parent 73f0844c
Pipeline #262663 canceled with stages
in 12 minutes and 30 seconds
...@@ -73,18 +73,21 @@ find_cargo_toml_from_file (GFile *file) ...@@ -73,18 +73,21 @@ find_cargo_toml_from_file (GFile *file)
if (file != NULL) if (file != NULL)
{ {
g_autoptr(GFile) parent = g_file_get_parent (file); g_autoptr(GFile) parent = g_file_get_parent (file);
g_autoptr(GFile) cargo_toml = g_file_get_child (parent, "Cargo.toml");
g_autofree gchar *name = g_file_get_basename (file); g_autofree gchar *name = g_file_get_basename (file);
if (parent != NULL)
{
g_autoptr(GFile) cargo_toml = g_file_get_child (parent, "Cargo.toml");
if (g_strcmp0 (name, "Cargo.toml") == 0) if (g_strcmp0 (name, "Cargo.toml") == 0)
return g_steal_pointer (&parent); return g_steal_pointer (&parent);
if (g_file_query_exists (cargo_toml, NULL)) if (g_file_query_exists (cargo_toml, NULL))
return g_steal_pointer (&cargo_toml); return g_steal_pointer (&cargo_toml);
if (parent != NULL)
return find_cargo_toml_from_file (parent); return find_cargo_toml_from_file (parent);
} }
}
return NULL; return NULL;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment