Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NextcloudTalk/Settings/NCUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,9 @@ import AVFoundation
public static func renderAspectImage(image: UIImage?, ofSize size: CGSize, scale: CGFloat, centerImage center: Bool) -> UIImage? {
guard let image else { return nil }

// UIGraphicsBeginImageContextWithOptions raises an exception for empty or non finite sizes
guard size.width > 0, size.height > 0, size.width.isFinite, size.height.isFinite else { return nil }

let newRect = CGRect(x: 0, y: 0, width: size.width, height: size.height)
UIGraphicsBeginImageContextWithOptions(newRect.size, false, scale)

Expand Down
9 changes: 6 additions & 3 deletions NextcloudTalk/User Interface/AvatarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ import SDWebImage
// MARK: - User status

public func setStatus(for room: NCRoom, allowCustomStatusIcon statusIconAllowed: Bool) {
self.room = room
self.allowCustomStatusIcon = statusIconAllowed

// layoutSubviews can run while the view is collapsed, rendering a status image of that size would raise an exception
guard statusImageSize(padding: 2) > 0 else { return }

if room.type == .oneToOne, let roomStatus = room.status {
if roomStatus != "dnd", statusIconAllowed, let roomStatusIcon = room.statusIcon {
setUserStatusIcon(roomStatusIcon)
Expand All @@ -164,9 +170,6 @@ import SDWebImage
}
}

self.room = room
self.allowCustomStatusIcon = statusIconAllowed

setUserStatusImageViewCutoutLayer()
}

Expand Down
Loading