{"action":"closed","issue":{"url":"https://api.github.com/repos/spf13/hugo/issues/948","labels_url":"https://api.github.com/repos/spf13/hugo/issues/948/labels{/name}","comments_url":"https://api.github.com/repos/spf13/hugo/issues/948/comments","events_url":"https://api.github.com/repos/spf13/hugo/issues/948/events","html_url":"https://github.com/spf13/hugo/issues/948","id":60024213,"number":948,"title":"Pagination panics with 0 pages","user":{"login":"caynan","id":1858994,"avatar_url":"https://avatars.githubusercontent.com/u/1858994?v=3","gravatar_id":"","url":"https://api.github.com/users/caynan","html_url":"https://github.com/caynan","followers_url":"https://api.github.com/users/caynan/followers","following_url":"https://api.github.com/users/caynan/following{/other_user}","gists_url":"https://api.github.com/users/caynan/gists{/gist_id}","starred_url":"https://api.github.com/users/caynan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caynan/subscriptions","organizations_url":"https://api.github.com/users/caynan/orgs","repos_url":"https://api.github.com/users/caynan/repos","events_url":"https://api.github.com/users/caynan/events{/privacy}","received_events_url":"https://api.github.com/users/caynan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spf13/hugo/labels/bug","name":"bug","color":"eb6420"},{"url":"https://api.github.com/repos/spf13/hugo/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"closed","locked":false,"assignee":{"login":"bep","id":394382,"avatar_url":"https://avatars.githubusercontent.com/u/394382?v=3","gravatar_id":"","url":"https://api.github.com/users/bep","html_url":"https://github.com/bep","followers_url":"https://api.github.com/users/bep/followers","following_url":"https://api.github.com/users/bep/following{/other_user}","gists_url":"https://api.github.com/users/bep/gists{/gist_id}","starred_url":"https://api.github.com/users/bep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bep/subscriptions","organizations_url":"https://api.github.com/users/bep/orgs","repos_url":"https://api.github.com/users/bep/repos","events_url":"https://api.github.com/users/bep/events{/privacy}","received_events_url":"https://api.github.com/users/bep/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-03-05T22:08:05Z","updated_at":"2015-03-05T23:48:39Z","closed_at":"2015-03-05T23:48:39Z","body":"Hello guys,\r\n\r\nI'm trying to build a blog using Hugo, I'm using the latest version of Hugo (brew formula) `v0.14-DEV BuildDate: 2015-02-22T03:09:28-05:00`\r\n\r\nI tryied to use the themes [hyde-x](https://github.com/zyro/hyde-x) from @zyro and [casper](https://github.com/vjeantet/hugo-theme-casper) from @vjeantet, both support pagination, and in both of them when I try to run `hugo` I receive the following error:\r\n\r\n**EDIT**:\r\n@zyro, just pointed out to me, this error only occurs if your content folder is empty.\r\n\r\nI think is a good idea to return a user friendly message instead of the stack trace.\r\n\r\nI'd love to help, I'm kind of new to Go, if anyone could point me the direction.\r\n\r\n```\r\npanic: runtime error: invalid memory address or nil pointer dereference [recovered]\r\n\tpanic: runtime error: invalid memory address or nil pointer dereference [recovered]\r\n\tpanic: runtime error: invalid memory address or nil pointer dereference\r\n[signal 0xb code=0x1 addr=0x0 pc=0x7d1a5]\r\n\r\ngoroutine 1 [running]:\r\ntext/template.errRecover(0xc2080991d8)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:100 +0xbc\r\ntext/template.errRecover(0xc208098070)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:100 +0xbc\r\ngithub.com/spf13/hugo/hugolib.(*pager).HasPrev(0x0, 0x0)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/hugo/hugolib/pagination.go:65 +0x5\r\nreflect.Value.call(0x633980, 0x0, 0x513, 0x663a70, 0x4, 0x99ac48, 0x0, 0x0, 0x0, 0x0, ...)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/reflect/value.go:419 +0x10e5\r\nreflect.Value.Call(0x633980, 0x0, 0x513, 0x99ac48, 0x0, 0x0, 0x0, 0x0, 0x0)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/reflect/value.go:296 +0xbc\r\ntext/template.(*state).evalCall(0xc208178300, 0x633980, 0x0, 0x16, 0x633980, 0x0, 0x513, 0xa9e450, 0xc2081638f0, 0xc2080bc192, ...)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:567 +0xaa4\r\ntext/template.(*state).evalField(0xc208178300, 0x633980, 0x0, 0x16, 0xc2080bc192, 0x7, 0xa9e450, 0xc2081638f0, 0xc20802bcb0, 0x1, ...)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:478 +0x34b\r\ntext/template.(*state).evalFieldChain(0xc208178300, 0x633980, 0x0, 0x16, 0x633980, 0x0, 0x16, 0xa9e450, 0xc2081638f0, 0xc20802bca0, ...)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:449 +0x2ad\r\ntext/template.(*state).evalFieldNode(0xc208178300, 0x633980, 0x0, 0x16, 0xc2081638f0, 0xc20802bcb0, 0x1, 0x1, 0x0, 0x0, ...)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:416 +0x1e6\r\ntext/template.(*state).evalCommand(0xc208178300, 0x633980, 0x0, 0x16, 0xc2081638c0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:354 +0xb39\r\ntext/template.(*state).evalPipeline(0xc208178300, 0x633980, 0x0, 0x16, 0xc20802f900, 0x0, 0x0, 0x0)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:332 +0x1a8\r\ntext/template.(*state).walkIfOrWith(0xc208178300, 0xa, 0x633980, 0x0, 0x16, 0xc20802f900, 0xc208163920, 0x0)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:196 +0xa8\r\ntext/template.(*state).walk(0xc208178300, 0x633980, 0x0, 0x16, 0xa9ff10, 0xc2080ffcc0)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:172 +0x616\r\ntext/template.(*state).walk(0xc208178300, 0x633980, 0x0, 0x16, 0xaa3288, 0xc208163830)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:175 +0x862\r\ntext/template.(*Template).Execute(0xc20800b880, 0xa9e6c8, 0xc208061e30, 0x633980, 0x0, 0x0, 0x0)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:155 +0x3f2\r\nhtml/template.(*Template).ExecuteTemplate(0xc2080fe440, 0xa9e6c8, 0xc208061e30, 0xc20817d0e0, 0x1e, 0x633980, 0x0, 0x0, 0x0)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/html/template/template.go:92 +0xc0\r\ngithub.com/spf13/hugo/tpl.ExecuteTemplate(0x633980, 0x0, 0xc208061e30, 0xc20817d0a0, 0x2, 0x2)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/hugo/tpl/template.go:1118 +0x1d6\r\ngithub.com/spf13/hugo/tpl.ExecuteTemplateToHTML(0x633980, 0x0, 0xc20817d0a0, 0x2, 0x2, 0x0, 0x0)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/hugo/tpl/template.go:1135 +0xaa\r\ngithub.com/spf13/hugo/tpl.Partial(0xc20806291d, 0xf, 0xc208186050, 0x1, 0x1, 0x0, 0x0)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/hugo/tpl/template.go:1104 +0x260\r\nreflect.Value.call(0x54e9c0, 0x7ab630, 0x13, 0x663a70, 0x4, 0xc20817ae40, 0x2, 0x2, 0x0, 0x0, ...)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/reflect/value.go:419 +0x10e5\r\nreflect.Value.Call(0x54e9c0, 0x7ab630, 0x13, 0xc20817ae10, 0x2, 0x2, 0x0, 0x0, 0x0)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/reflect/value.go:296 +0xbc\r\ntext/template.(*state).evalCall(0xc20800bd40, 0x6317c0, 0xc2080ec000, 0x16, 0x54e9c0, 0x7ab630, 0x13, 0xaa3318, 0xc2081625a0, 0xc208062914, ...)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:567 +0xaa4\r\ntext/template.(*state).evalFunction(0xc20800bd40, 0x6317c0, 0xc2080ec000, 0x16, 0xc2081625d0, 0xaa3318, 0xc2081625a0, 0xc20800af00, 0x3, 0x4, ...)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:459 +0x33b\r\ntext/template.(*state).evalCommand(0xc20800bd40, 0x6317c0, 0xc2080ec000, 0x16, 0xc2081625a0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:359 +0x210\r\ntext/template.(*state).evalPipeline(0xc20800bd40, 0x6317c0, 0xc2080ec000, 0x16, 0xc20802eb40, 0x0, 0x0, 0x0)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:332 +0x1a8\r\ntext/template.(*state).walk(0xc20800bd40, 0x6317c0, 0xc2080ec000, 0x16, 0xa9e498, 0xc208162630)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:167 +0x145\r\ntext/template.(*state).walk(0xc20800bd40, 0x6317c0, 0xc2080ec000, 0x16, 0xaa3288, 0xc2080f6d80)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:175 +0x862\r\ntext/template.(*Template).Execute(0xc20800acc0, 0xa9e6c8, 0xc208061340, 0x6317c0, 0xc2080ec000, 0x0, 0x0)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/text/template/exec.go:155 +0x3f2\r\nhtml/template.(*Template).ExecuteTemplate(0xc2080fe440, 0xa9e6c8, 0xc208061340, 0xc20812a620, 0x10, 0x6317c0, 0xc2080ec000, 0x0, 0x0)\r\n\t/usr/local/Cellar/go/1.4.2/libexec/src/html/template/template.go:92 +0xc0\r\ngithub.com/spf13/hugo/hugolib.(*Site).renderThing(0xc2080fc000, 0x6317c0, 0xc2080ec000, 0xc20812a620, 0x10, 0xa9e6c8, 0xc208061340, 0x0, 0x0)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/hugo/hugolib/site.go:1449 +0x210\r\ngithub.com/spf13/hugo/hugolib.(*Site).render(0xc2080fc000, 0x6a7490, 0x8, 0x6317c0, 0xc2080ec000, 0xc208061340, 0xc208128500, 0x6, 0x8, 0x0, ...)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/hugo/hugolib/site.go:1424 +0x2c0\r\ngithub.com/spf13/hugo/hugolib.(*Site).renderAndWritePage(0xc2080fc000, 0x6a7490, 0x8, 0x661510, 0x1, 0x6317c0, 0xc2080ec000, 0xc208128500, 0x6, 0x8, ...)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/hugo/hugolib/site.go:1387 +0xdf\r\ngithub.com/spf13/hugo/hugolib.(*Site).RenderHomePage(0xc2080fc000, 0x0, 0x0)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/hugo/hugolib/site.go:1201 +0x178\r\ngithub.com/spf13/hugo/hugolib.(*Site).Render(0xc2080fc000, 0x0, 0x0)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/hugo/hugolib/site.go:395 +0x1a1\r\ngithub.com/spf13/hugo/hugolib.(*Site).Build(0xc2080fc000, 0x0, 0x0)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/hugo/hugolib/site.go:244 +0x84\r\ngithub.com/spf13/hugo/commands.buildSite(0xc208099a27, 0x1, 0x1, 0x0, 0x0)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/hugo/commands/hugo.go:342 +0xd2\r\ngithub.com/spf13/hugo/commands.build(0xc208099b5e, 0x1, 0x1)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/hugo/commands/hugo.go:254 +0x2cb\r\ngithub.com/spf13/hugo/commands.server(0x98b8e0, 0xc20801e680, 0x0, 0x2)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/hugo/commands/server.go:97 +0x58a\r\ngithub.com/spf13/cobra.(*Command).execute(0x98b8e0, 0xc20801e5c0, 0x2, 0x2, 0x0, 0x0)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/cobra/command.go:399 +0x38d\r\ngithub.com/spf13/cobra.(*Command).findAndExecute(0x98ada0, 0xc20800a010, 0x3, 0x3, 0x0, 0x0)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/cobra/command.go:366 +0xd4\r\ngithub.com/spf13/cobra.(*Command).Execute(0x98ada0, 0x0, 0x0)\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/cobra/command.go:452 +0xab3\r\ngithub.com/spf13/hugo/commands.Execute()\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/src/github.com/spf13/hugo/commands/hugo.go:64 +0x2f\r\nmain.main()\r\n\t/private/tmp/hugo-Zc2OIW/hugo-0.13/main.go:24 +0x2f\r\n```\r\n\r\nAny ideia on what might be causing this?\r\n\r\nThank you"}}