diff --git a/src/datapack/mod.rs b/src/datapack/mod.rs index 06e7f0d..eccfced 100644 --- a/src/datapack/mod.rs +++ b/src/datapack/mod.rs @@ -195,13 +195,15 @@ impl Datapack { } if let Some(uninstall_commands) = uninstall_commands { - let main_namespace = modified_namespaces - .entry(&self.main_namespace_name) - .or_insert_with(|| Cow::Owned(Namespace::new(&self.main_namespace_name))); - let uninstall_function = main_namespace.to_mut().function_mut("uninstall"); - uninstall_function - .get_commands_mut() - .extend(uninstall_commands); + if !uninstall_commands.is_empty() { + let main_namespace = modified_namespaces + .entry(&self.main_namespace_name) + .or_insert_with(|| Cow::Owned(Namespace::new(&self.main_namespace_name))); + let uninstall_function = main_namespace.to_mut().function_mut("uninstall"); + uninstall_function + .get_commands_mut() + .extend(uninstall_commands); + } } // Compile namespaces