Fix integer attributes

This commit is contained in:
Filip Tibell 2023-03-26 12:43:01 +02:00
parent 4cb260c7dd
commit 7c9a1bef86
No known key found for this signature in database
2 changed files with 7 additions and 0 deletions

View file

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed instances with attributes not saving if they container integer attributes
- Fixed attributes not being set properly if the instance has an empty attributes property
- 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

View file

@ -516,6 +516,12 @@ impl Instance {
let inst = dom
.get_by_ref_mut(self.dom_ref)
.expect("Failed to find instance in document");
// NOTE: Attributes do not support integers, only floats
let value = match value {
DomValue::Int32(i) => DomValue::Float32(i as f32),
DomValue::Int64(i) => DomValue::Float64(i as f64),
value => value,
};
if let Some(DomValue::Attributes(attributes)) =
inst.properties.get_mut(PROPERTY_NAME_ATTRIBUTES)
{