core: Fix panic from negative array indices in SharedObject (fix #3094)

This commit is contained in:
Mike Welsh 2021-02-04 19:11:46 -08:00
parent cfbb5751e8
commit 937393ce07
2 changed files with 10 additions and 2 deletions

View File

@ -134,8 +134,8 @@ fn deserialize_array<'gc>(
for entry in json_obj.iter() {
let value = recursive_deserialize(entry.1.clone(), activation);
if let Ok(i) = entry.0.parse::<i32>() {
obj.set_array_element(i as usize, value, activation.context.gc_context);
if let Ok(i) = entry.0.parse::<usize>() {
obj.set_array_element(i, value, activation.context.gc_context);
} else {
obj.define_value(
activation.context.gc_context,

View File

@ -1013,6 +1013,14 @@ impl Player {
&mut self.renderer
}
pub fn storage(&self) -> &Storage {
&self.storage
}
pub fn storage_mut(&mut self) -> &mut Storage {
&mut self.storage
}
pub fn destroy(self) -> Renderer {
self.renderer
}