Skip to content

Commit

Permalink
Fix nil where an image has no...image?
Browse files Browse the repository at this point in the history
  • Loading branch information
lxcode committed Oct 3, 2024
1 parent 0315069 commit 3d025fc
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/hydrator/hydrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,13 +403,15 @@ func (h *Hydrator) flattenEmbed(embed *bsky.FeedPost_Embed) (result map[string]i
for _, image := range embed.EmbedImages.Images {
imageResult := make(map[string]interface{})
imageResult["Alt"] = image.Alt
imageResult["BlobLink"] = image.Image.Ref.String()
imageResult["MimeType"] = image.Image.MimeType
if image.AspectRatio != nil {
imageResult["Width"] = image.AspectRatio.Width
imageResult["Height"] = image.AspectRatio.Height
if image.Image != nil {
imageResult["BlobLink"] = image.Image.Ref.String()
imageResult["MimeType"] = image.Image.MimeType
if image.AspectRatio != nil {
imageResult["Width"] = image.AspectRatio.Width
imageResult["Height"] = image.AspectRatio.Height
}
imageResult["MimeType"] = image.Image.MimeType
}
imageResult["MimeType"] = image.Image.MimeType
images = append(images, imageResult)
}
result["Images"] = images
Expand Down

0 comments on commit 3d025fc

Please sign in to comment.