Skip to content

Commit

Permalink
Fix power level events force unwrap crash
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanceriu committed Aug 21, 2023
1 parent 71631c1 commit 2adb8c2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion MatrixSDK/Space/MXSpace.swift
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,11 @@ public class MXSpace: NSObject {
///
/// - Returns: the mimnimum power level required to add a room to this space
public func minimumPowerLevelForAddingRoom(with powerLevels: MXRoomPowerLevels) -> Int {
return powerLevels.events["m.space.child"] as? Int ?? powerLevels.stateDefault
guard let events = powerLevels.events else {
return powerLevels.stateDefault
}

return events["m.space.child"] as? Int ?? powerLevels.stateDefault
}

// MARK: - Private
Expand Down

0 comments on commit 2adb8c2

Please sign in to comment.