Fix runtime errors

This commit is contained in:
Nathan Sobo 2023-10-23 11:34:35 +02:00
parent 5247f217fd
commit da8919002f
7 changed files with 31 additions and 20 deletions

View file

@ -603,7 +603,7 @@ pub struct GroupBounds(HashMap<SharedString, SmallVec<[Bounds<Pixels>; 1]>>);
impl GroupBounds {
pub fn get(name: &SharedString, cx: &mut AppContext) -> Option<Bounds<Pixels>> {
cx.default_global::<Self>()
cx.default_global_mut::<Self>()
.0
.get(name)
.and_then(|bounds_stack| bounds_stack.last())
@ -611,7 +611,7 @@ impl GroupBounds {
}
pub fn push(name: SharedString, bounds: Bounds<Pixels>, cx: &mut AppContext) {
cx.default_global::<Self>()
cx.default_global_mut::<Self>()
.0
.entry(name)
.or_default()
@ -619,7 +619,7 @@ impl GroupBounds {
}
pub fn pop(name: &SharedString, cx: &mut AppContext) {
cx.default_global::<GroupBounds>()
cx.default_global_mut::<Self>()
.0
.get_mut(name)
.unwrap()