blockquote: Fix invalid access

This commit is contained in:
Manuel Rüger
2024-10-05 23:56:07 +02:00
parent d5c41f6f1f
commit 33e5d1ff19
5 changed files with 18 additions and 3 deletions

View File

@@ -118,13 +118,12 @@ func ParseBlockQuoteType(node ast.Node, source []byte) BlockQuoteType {
// Classifying the next text type node (midNode) will confirm that.
if t == None {
midNode := node.NextSibling()
rightNode := midNode.NextSibling()
if midNode.Kind() == ast.KindText {
if midNode != nil && midNode.Kind() == ast.KindText {
rightNode := midNode.NextSibling()
midTextNode := midNode.(*ast.Text)
if rightNode != nil && rightNode.Kind() == ast.KindText {
rightTextNode := rightNode.(*ast.Text)
if string(n.Text(source)) == "[" && string(rightTextNode.Text(source)) == "]" {
t = ghAlertsClassifier.ClassifyingBlockQuote(string(midTextNode.Text(source)))
}