Hello,
I tried building the latest hugo from the master branch, but l see the⦠`draft=true` crash happening if a branch bundle `_index.md` content file has `draft=true`.
Here's one such example content file: https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io/blob/crash-hugo-v57-draft-branch-bundle/content/series/gujarati-in-emacs/_index.md
## Recipe to reproduce the crash
1. `git clone --recurse-submodules --single-branch --branch crash-hugo-v57-draft-branch-bundle https://gitlab.com/kaushalmodi/kaushalmodi.gitlab.io scripter.co`
2. `cd scripter.co`
3. `hugo`
## Crash report
```
Building sites β¦ ERROR 2019/08/15 11:39:41 [BUG] Got panic:
goroutine 128 [running]:
runtime/debug.Stack(0x14b7f20, 0xc002a228b0, 0xc002af9508)
/home/kmodi/go/src/runtime/debug/stack.go:24 +0x9d
github.com/gohugoio/hugo/hugolib.newPageContentOutput.func1.1.1(0xc002af9c00, 0xc0011ddb60)
/home/kmodi/downloads/git/hugo/hugolib/page__per_output.go:74 +0x109
panic(0x1486d20, 0x2627580)
/home/kmodi/go/src/runtime/panic.go:522 +0x1b5
github.com/gohugoio/hugo/hugolib.pageContent.contentToRender(0x1, 0x0, 0x0, 0x0, 0x0, 0xc000a55f80, 0x0, 0x19ee8c0, 0xc001260750, 0xdf, ...)
/home/kmodi/downloads/git/hugo/hugolib/page__content.go:49 +0xba
github.com/gohugoio/hugo/hugolib.newPageContentOutput.func1.1(0x19de920, 0xc002a228b0)
/home/kmodi/downloads/git/hugo/hugolib/page__per_output.go:90 +0x1e3
github.com/gohugoio/hugo/hugolib.newPageContentOutput.func1.3(0x14fada0, 0xc00239c430, 0x14f8640, 0xc002af9c68)
/home/kmodi/downloads/git/hugo/hugolib/page__per_output.go:170 +0x26
github.com/gohugoio/hugo/lazy.(*Init).Do.func1()
/home/kmodi/downloads/git/hugo/lazy/init.go:97 +0x139
github.com/gohugoio/hugo/lazy.(*onceMore).Do(0xc000cbc088, 0xc002af9cb8)
/home/kmodi/downloads/git/hugo/lazy/once.go:53 +0xf0
github.com/gohugoio/hugo/lazy.(*Init).Do(0xc000cbc060, 0x8, 0x203000, 0x203000, 0x1457ba0)
/home/kmodi/downloads/git/hugo/lazy/init.go:79 +0x5b
github.com/gohugoio/hugo/hugolib.(*Site).initInit(0xc00046b880, 0xc000cbc060, 0x19fa900, 0xc0011ddb60)
/home/kmodi/downloads/git/hugo/hugolib/site.go:181 +0x2b
github.com/gohugoio/hugo/hugolib.(*pageContentOutput).Content(0xc000cb84e0, 0xc000a9b380, 0x43d9c4, 0x140b2a0, 0x28)
/home/kmodi/downloads/git/hugo/hugolib/page__per_output.go:233 +0x5a
reflect.Value.call(0x1638dc0, 0xc0011ddb60, 0x1e13, 0x163faee, 0x4, 0x2674e30, 0x0, 0x0, 0xc00173b300, 0xc002afa160, ...)
/home/kmodi/go/src/reflect/value.go:447 +0x461
reflect.Value.Call(0x1638dc0, 0xc0011ddb60, 0x1e13, 0x2674e30, 0x0, 0x0, 0x443abc, 0x0, 0x162f0e0)
/home/kmodi/go/src/reflect/value.go:308 +0xa4
text/template.safeCall(0x1638dc0, 0xc0011ddb60, 0x1e13, 0x2674e30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/home/kmodi/go/src/text/template/funcs.go:293 +0xb6
text/template.(*state).evalCall(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0x1638dc0, 0xc0011ddb60, 0x1e13, 0x1a08d80, 0xc00075a810, 0xc0002158ac, ...)
/home/kmodi/go/src/text/template/exec.go:703 +0x68c
text/template.(*state).evalField(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0xc0002158ac, 0x7, 0x1a08d80, 0xc00075a810, 0xc000815d00, 0x1, ...)
/home/kmodi/go/src/text/template/exec.go:593 +0xd61
text/template.(*state).evalFieldChain(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0x1638dc0, 0xc0011ddb60, 0x16, 0x1a08d80, 0xc00075a810, 0xc000815cf0, ...)
/home/kmodi/go/src/text/template/exec.go:554 +0x220
text/template.(*state).evalFieldNode(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0xc00075a810, 0xc000815d00, 0x1, 0x1, 0x14870e0, 0x2674e30, ...)
/home/kmodi/go/src/text/template/exec.go:518 +0x114
text/template.(*state).evalCommand(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0xc00075a7e0, 0x14870e0, 0x2674e30, 0x99, 0x26761a0, 0x3, ...)
/home/kmodi/go/src/text/template/exec.go:456 +0x7a8
text/template.(*state).evalPipeline(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0xc000756960, 0xc000758500, 0x13eb5c0, 0x26761a0)
/home/kmodi/go/src/text/template/exec.go:430 +0x11c
text/template.(*state).evalArg(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0x1a41180, 0x1454360, 0x1a08f00, 0xc000756960, 0x13eb5c0, 0x26761a0, ...)
/home/kmodi/go/src/text/template/exec.go:785 +0x7b9
text/template.(*state).evalCall(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0x144d220, 0xc0006e2040, 0x13, 0x1a08d00, 0xc00075a780, 0xc0002158a4, ...)
/home/kmodi/go/src/text/template/exec.go:678 +0x280
text/template.(*state).evalFunction(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0xc00075a7b0, 0x1a08d00, 0xc00075a780, 0xc000758600, 0x3, 0x4, ...)
/home/kmodi/go/src/text/template/exec.go:564 +0x170
text/template.(*state).evalCommand(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0xc00075a780, 0x14870e0, 0x2674e30, 0x99, 0xc002abe000, 0x7fd0e5c2d460, ...)
/home/kmodi/go/src/text/template/exec.go:461 +0x66c
text/template.(*state).evalPipeline(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0xc000756900, 0xc0019b80c0, 0x20, 0x18)
/home/kmodi/go/src/text/template/exec.go:430 +0x11c
text/template.(*state).evalArg(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0x1a41180, 0x162f0e0, 0x1a08f00, 0xc000756900, 0x1454360, 0xc00208b7d0, ...)
/home/kmodi/go/src/text/template/exec.go:785 +0x7b9
text/template.(*state).evalCall(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0x14247a0, 0xc0006e2160, 0x13, 0x1a08d00, 0xc00075a720, 0xc00021589f, ...)
/home/kmodi/go/src/text/template/exec.go:678 +0x280
text/template.(*state).evalFunction(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0xc00075a750, 0x1a08d00, 0xc00075a720, 0xc00065a640, 0x2, 0x2, ...)
/home/kmodi/go/src/text/template/exec.go:564 +0x170
text/template.(*state).evalCommand(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0xc00075a720, 0x14870e0, 0x2674e30, 0x99, 0xc00021d180, 0x334, ...)
/home/kmodi/go/src/text/template/exec.go:461 +0x66c
text/template.(*state).evalPipeline(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0xc0007568a0, 0x465c1a, 0x26280c0, 0xc00304a980)
/home/kmodi/go/src/text/template/exec.go:430 +0x11c
text/template.(*state).evalCommand(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0xc00075a6f0, 0x14870e0, 0x2674e30, 0x99, 0xc002afb2d0, 0x59d3a5, ...)
/home/kmodi/go/src/text/template/exec.go:464 +0x8f0
text/template.(*state).evalPipeline(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0xc000756840, 0x0, 0x0, 0x98)
/home/kmodi/go/src/text/template/exec.go:430 +0x11c
text/template.(*state).walk(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0x1a08c00, 0xc00075a8a0)
/home/kmodi/go/src/text/template/exec.go:254 +0x49c
text/template.(*state).walk(0xc002afb470, 0x1638dc0, 0xc0011ddb60, 0x16, 0x1a08e40, 0xc00075a4e0)
/home/kmodi/go/src/text/template/exec.go:262 +0x143
text/template.(*state).walkTemplate(0xc002afb650, 0x1638dc0, 0xc0011ddb60, 0x16, 0xc000848b40)
/home/kmodi/go/src/text/template/exec.go:412 +0x222
text/template.(*state).walk(0xc002afb650, 0x1638dc0, 0xc0011ddb60, 0x16, 0x1a08fc0, 0xc000848b40)
/home/kmodi/go/src/text/template/exec.go:267 +0x206
text/template.(*state).walk(0xc002afb650, 0x1638dc0, 0xc0011ddb60, 0x16, 0x1a08e40, 0xc000847bc0)
/home/kmodi/go/src/text/template/exec.go:262 +0x143
text/template.(*Template).execute(0xc0008f7480, 0x19de600, 0xc0043f8540, 0x1638dc0, 0xc0011ddb60, 0x0, 0x0)
/home/kmodi/go/src/text/template/exec.go:217 +0x1e8
text/template.(*Template).Execute(...)
/home/kmodi/go/src/text/template/exec.go:200
html/template.(*Template).Execute(0xc0006d2450, 0x19de600, 0xc0043f8540, 0x1638dc0, 0xc0011ddb60, 0x19eea80, 0xc002edf1d0)
/home/kmodi/go/src/html/template/template.go:122 +0x8d
github.com/gohugoio/hugo/tpl.(*TemplateAdapter).Execute(0xc002edf1d0, 0x19de600, 0xc0043f8540, 0x1638dc0, 0xc0011ddb60, 0x0, 0x0)
/home/kmodi/downloads/git/hugo/tpl/template.go:163 +0xaf
github.com/gohugoio/hugo/hugolib.(*Site).renderForLayouts(0xc00046b880, 0x1653087, 0x8, 0x163fc66, 0x4, 0x1638dc0, 0xc0011ddb60, 0x19de600, 0xc0043f8540, 0xc00157fc00, ...)
/home/kmodi/downloads/git/hugo/hugolib/site.go:1597 +0xb8
github.com/gohugoio/hugo/hugolib.(*Site).renderAndWritePage(0xc00046b880, 0xc0002ef410, 0xc001cd8190, 0x4a, 0xc000ca8f60, 0x24, 0xc0011ddb60, 0xc00157fc00, 0x24, 0x40, ...)
/home/kmodi/downloads/git/hugo/hugolib/site.go:1513 +0x1ce
github.com/gohugoio/hugo/hugolib.pageRenderer(0xc0014eb840, 0xc00046b880, 0xc000cbc2a0, 0xc0006949c0, 0xc000f8b680)
/home/kmodi/downloads/git/hugo/hugolib/site_render.go:152 +0x5f2
created by github.com/gohugoio/hugo/hugolib.(*Site).renderPages
/home/kmodi/downloads/git/hugo/hugolib/site_render.go:73 +0x160
Total in 4117 ms
Error: Error building site: "/home/kmodi/temp/scripter.co/content/series/gujarati-in-emacs/_index.md:1:1": runtime error: invalid memory address or nil pointer dereference
```