Fix crash when saving unsupported attributes

This commit is contained in:
Filip Tibell 2023-03-26 11:54:44 +02:00
parent 309958deed
commit 0c46a82b10
No known key found for this signature in database
2 changed files with 4 additions and 3 deletions

View file

@ -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

View file

@ -24,11 +24,12 @@ pub fn ensure_valid_attribute_name(name: impl AsRef<str>) -> 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(())