.Get doesn't crash on missing positional param
authorcmal <paul@cmal.info>
Tue, 17 Apr 2018 09:24:03 +0000 (11:24 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 17 Apr 2018 13:39:33 +0000 (15:39 +0200)
fixes #4619

hugolib/shortcode.go

index 3cf472f82ce0a114beba3cea261d6ff2c09563d3..78971132b65ad7df03dcd2e45a6e0b59f73e9119 100644 (file)
@@ -86,8 +86,7 @@ func (scp *ShortcodeWithPage) Get(key interface{}) interface{} {
                        idx := int(reflect.ValueOf(key).Int())
                        ln := reflect.ValueOf(scp.Params).Len()
                        if idx > ln-1 {
-                               helpers.DistinctErrorLog.Printf("No shortcode param at .Get %d in page %s, have params: %v", idx, scp.Page.FullFilePath(), scp.Params)
-                               return fmt.Sprintf("error: index out of range for positional param at position %d", idx)
+                               return ""
                        }
                        x = reflect.ValueOf(scp.Params).Index(idx)
                }