fix for index out of range when checking if next paragraph is media.

This commit is contained in:
fiatjaf
2024-01-12 10:08:13 -03:00
parent c80cb3ce29
commit d7bab9b31a

View File

@@ -209,7 +209,7 @@ func drawParagraphs(paragraphs []string, fontSize int, width, height int) (image
paragraph := paragraphs[i]
// Skip empty lines if the next element is an image
if paragraph == "" && isMediaURL(paragraphs[i+1]) {
if paragraph == "" && len(paragraphs) > i && isMediaURL(paragraphs[i+1]) {
continue
}