fix out of range about MapArticels

This commit is contained in:
deepzz0
2017-03-02 22:47:44 +08:00
parent 7775ea35a2
commit 3eaab0fb1f

View File

@@ -119,8 +119,8 @@ func HandleArchivesPage(c *gin.Context) {
func HandleArticlePage(c *gin.Context) {
path := c.Param("slug")
artc := Ei.MapArticles[path[0:strings.Index(path, ".")]]
if artc == nil {
index := strings.Index(path, ".")
if index < 0 || Ei.MapArticles[path[0:index]] == nil {
HandleNotFound(c)
return
}