Skip to content

Commit

Permalink
[Spaces] Show spaces in left panel #4509
Browse files Browse the repository at this point in the history
- Prevent crash when logging in
  • Loading branch information
gileluard committed Jul 16, 2021
1 parent f1da8c2 commit 63da1ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Riot/Modules/SideMenu/SideMenuViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ final class SideMenuViewModel: SideMenuViewModelType {
}

private func userAvatarViewData(from mxSession: MXSession) -> UserAvatarViewData? {
guard let userId = mxSession.myUserId, let mediaManager = mxSession.mediaManager else {
guard let userId = mxSession.myUserId, let mediaManager = mxSession.mediaManager, let myUser = mxSession.myUser else {
return nil
}
let userDisplayName = mxSession.myUser.displayname
let avatarUrl = mxSession.myUser.avatarUrl

let userDisplayName = myUser.displayname
let avatarUrl = myUser.avatarUrl

return UserAvatarViewData(userId: userId,
displayName: userDisplayName,
Expand Down
3 changes: 3 additions & 0 deletions Riot/Modules/Spaces/SpaceList/SpaceListViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ final class SpaceListViewModel: SpaceListViewModelType {
}

private func loadData() {
guard session.mediaManager != nil else {
return
}

self.update(viewState: .loading)

Expand Down

0 comments on commit 63da1ab

Please sign in to comment.