From d7bab9b31a577aedbd5c2213621c5f3cedac0f2e Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Fri, 12 Jan 2024 10:08:13 -0300 Subject: [PATCH] fix for index out of range when checking if next paragraph is media. --- render_image.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/render_image.go b/render_image.go index 30a4388..8c7459e 100644 --- a/render_image.go +++ b/render_image.go @@ -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 }