cleaner failures when media fails to load or draw.

This commit is contained in:
fiatjaf
2024-01-12 11:00:52 -03:00
parent 8c5fa1aba8
commit a9c84f86d7
2 changed files with 18 additions and 5 deletions

View File

@@ -217,8 +217,15 @@ func drawParagraphs(paragraphs []string, fontSize int, width, height int) (image
if i == 0 {
yPos = 0
}
yPos = drawMediaAt(img, paragraph, yPos)
continue
next := drawMediaAt(img, paragraph, yPos)
if next != -1 {
yPos = next
// this means the media picture was successfully drawn
continue
}
// if we reach here that means we didn't draw anything, so proceed to
// draw the text
}
rawText := []rune(paragraph)