Skip to content

Commit

Permalink
Merge branch 'develop' into mauroromito/filter_implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Velin92 authored Feb 8, 2024
2 parents 2780634 + e1d1e99 commit 4462c64
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
var aspectRatio: CGFloat?
let width = imageInfo.width.map(CGFloat.init)
let height = imageInfo.height.map(CGFloat.init)
if let width, let height {
if let width, let height, width > 0, height > 0 {
aspectRatio = width / height
}

Expand Down Expand Up @@ -488,7 +488,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
let height = messageContent.info?.height.map(CGFloat.init)

var aspectRatio: CGFloat?
if let width, let height {
if let width, let height, width > 0, height > 0 {
aspectRatio = width / height
}

Expand All @@ -508,7 +508,7 @@ struct RoomTimelineItemFactory: RoomTimelineItemFactoryProtocol {
let height = messageContent.info?.height.map(CGFloat.init)

var aspectRatio: CGFloat?
if let width, let height {
if let width, let height, width > 0, height > 0 {
aspectRatio = width / height
}

Expand Down
1 change: 1 addition & 0 deletions changelog.d/pr-2437.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevent crashes when computing aspect ratios on zero media width or height

0 comments on commit 4462c64

Please sign in to comment.