Permalink
Browse files

.Get doesn't crash on missing positional param

fixes #4619
  • Loading branch information...
paulcmal authored and bep committed Apr 17, 2018
1 parent cd6a261 commit 236f0c840b45e0c41fcbb2fb6ee556c0fb2d4859
Showing with 1 addition and 2 deletions.
  1. +1 −2 hugolib/shortcode.go
@@ -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)
}

0 comments on commit 236f0c8

Please sign in to comment.