codegen: don't panic when no package_names are present
@@ -141,8 +141,7 @@ fn fill_in(root: &mut Table, env: &Env) {
let meta = upsert_table(meta, "system-deps");
let ns = env.namespaces.main();
- let lib_name = ns.package_names.first().unwrap();
-
+ if let Some(lib_name) = ns.package_names.first() {
let meta = upsert_table(meta, nameutil::lib_name_to_toml(lib_name));
// Allow both the name and version of a system dep to be overridden by hand
meta.entry("name")
@@ -164,6 +163,7 @@ fn fill_in(root: &mut Table, env: &Env) {
.or_insert_with(|| Value::String(lib_version.to_string()));
});
}
+ }
{
// Small trick to prevent having double quotes around it since toml doesn't like
