InkProject / ink

An elegant static blog generator

Home Page:https://inkproject.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

主题静态目录写死导致panic

akkuman opened this issue · comments

在serve.go约50行处

	var dirs = []string{
		filepath.Join(rootPath, "source"),
		filepath.Join(themePath, "bundle"),
	}

自己在主题文件目录下定义新的静态文件夹名会panic,出现这样的错误.

Finished to build in public folder (8.756469ms)
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x14 pc=0x833e8ad]

goroutine 1 [running]:
main.Watch.func2(0x18b7a3e0, 0x1b, 0x0, 0x0, 0x8574770, 0x18b7a3c0, 0x0, 0x0)
        /Users/imeoer/go/src/github.com/InkProject/ink/serve.go:52 +0x1d
github.com/facebookgo/symwalk.walk.func1(0x18b7a3e0, 0x1b, 0x0, 0x0, 0x8574770, 0x18b7a3c0, 0x20, 0x83a9800)
        /Users/imeoer/go/src/github.com/facebookgo/symwalk/walk.go:42 +0xff
path/filepath.Walk(0x18b7a060, 0x1b, 0x18b7a380, 0x0, 0x0)
        /usr/local/go/src/path/filepath/path.go:396 +0x74
github.com/facebookgo/symwalk.walk(0x18b7a060, 0x1b, 0x18b7a060, 0x1b, 0x84000a4, 0x0, 0x0)
        /Users/imeoer/go/src/github.com/facebookgo/symwalk/walk.go:44 +0x95
github.com/facebookgo/symwalk.Walk(0x18b7a060, 0x1b, 0x84000a4, 0x0, 0x0)
        /Users/imeoer/go/src/github.com/facebookgo/symwalk/walk.go:49 +0x39
main.Watch()
        /Users/imeoer/go/src/github.com/InkProject/ink/serve.go:58 +0x227
main.main.func2(0x188901e0, 0x0, 0x188901e0)
        /Users/imeoer/go/src/github.com/InkProject/ink/main.go:49 +0x30
github.com/codegangsta/cli.HandleAction(0x83808e0, 0x84000b0, 0x188901e0, 0x1887a300, 0x0)
        /Users/imeoer/go/src/github.com/codegangsta/cli/app.go:485 +0xa2
github.com/codegangsta/cli.Command.Run(0x83e612d, 0x7, 0x0, 0x0, 0x0, 0x0, 0x0, 0x83f4809, 0x22, 0x0, ...)
        /Users/imeoer/go/src/github.com/codegangsta/cli/command.go:207 +0x999
github.com/codegangsta/cli.(*App).Run(0x188d6410, 0x1887e030, 0x2, 0x2, 0x0, 0x0)
        /Users/imeoer/go/src/github.com/codegangsta/cli/app.go:250 +0x65a
main.main()
        /Users/imeoer/go/src/github.com/InkProject/ink/main.go:83 +0x20c

建议bundle改为从主题配置文件中读取

@akkuman 非常感谢建议,会加入这个改善。