hugolib: Change to output non-panic error message if missing shortcode template
authorVazrupe (HyeonGyu Lee) <vazrupe@naver.com>
Mon, 19 Aug 2019 14:26:53 +0000 (23:26 +0900)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Thu, 22 Aug 2019 08:40:16 +0000 (10:40 +0200)
A panic occurred when the `nested` variable was nil.
Changed to check if the `nested` variable is nil.

Fixes #6075

hugolib/shortcode.go

index 895d0dcf2d8b93df3d8cb2523e58387733ecf33d..8323962c0c7b29980e228fcff7b95e9ef6bcdede 100644 (file)
@@ -473,9 +473,10 @@ Loop:
                                pt.Backup()
                                nested, err := s.extractShortcode(nestedOrdinal, nextLevel, pt)
                                nestedOrdinal++
-                               if nested.name != "" {
+                               if nested != nil && nested.name != "" {
                                        s.nameSet[nested.name] = true
                                }
+
                                if err == nil {
                                        sc.inner = append(sc.inner, nested)
                                } else {