Fusion textures: refuse metadata that is not an object

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
some-du6eandClaude Opus 5.5 committed 2026-11-01 18:29:17 -06:00
1 parent 778bb6d932
commit 6c5ee2d427
1 file changed
+5
@@ -131,6 +131,9 @@ impl Meta {
/// A `fusion` section (or a `sub_texture`).
pub fn parse(json: &Json) -> Result<Self, String> {
if json.as_object().is_none() {
return Err("a texture's Fusion metadata that isn't an object".into());
}
let base = Base {
emissive: bool_field(json, "emissive")?.unwrap_or(false),
render_type: choice(
@@ -399,6 +402,8 @@ mod tests {
r#"{"fusion": {"type": "scrolling", "loop_pause": -1}}"#,
r#"{"fusion": {"type": "connecting", "sub_texture": {"type": "random", "rows": 0}}}"#,
r#"{"fusion": {"type": "glowing"}}"#,
r#"{"fusion": "connecting"}"#,
r#"{"fusion": {"type": "connecting", "sub_texture": "random"}}"#,
r#"{"fusion": {"type": "connecting", "layout": "diagonal"}}"#,
r#"{"fusion": {"type": "base", "emissive": "yes"}}"#,
r#"{"fusion": {"type": "base", "render_type": "solid"}}"#,