From 0c46a82b10c10d726780f26d8bfcee70b9a30658 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Sun, 26 Mar 2023 11:54:44 +0200 Subject: [PATCH] Fix crash when saving unsupported attributes --- CHANGELOG.md | 1 + packages/lib-roblox/src/datatypes/attributes.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5036641..9116635 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed error messages for reading & writing roblox files not containing the full error message - Fixed crash when trying to access an instance reference property that points to a destroyed instance +- Fixed crash when trying to save instances that contain unsupported attribute types ## `0.6.3` - March 26th, 2023 diff --git a/packages/lib-roblox/src/datatypes/attributes.rs b/packages/lib-roblox/src/datatypes/attributes.rs index b42acdb..42c55fd 100644 --- a/packages/lib-roblox/src/datatypes/attributes.rs +++ b/packages/lib-roblox/src/datatypes/attributes.rs @@ -24,11 +24,12 @@ pub fn ensure_valid_attribute_name(name: impl AsRef) -> LuaResult<()> { } pub fn ensure_valid_attribute_value(value: &DomValue) -> LuaResult<()> { + // TODO: Uncomment supported types when they are also supported in rbx-dom serialization let is_valid = matches!( value.ty(), DomType::Bool | DomType::BrickColor - | DomType::CFrame + // | DomType::CFrame | DomType::Color3 | DomType::ColorSequence | DomType::Float32 @@ -42,8 +43,7 @@ pub fn ensure_valid_attribute_value(value: &DomValue) -> LuaResult<()> { | DomType::UDim | DomType::UDim2 | DomType::Vector2 - | DomType::Vector3 - | DomType::Font + | DomType::Vector3 // | DomType::Font ); if is_valid { Ok(())