From 3eaab0fb1f1b8d0e774a80d12a7a276705d3fe41 Mon Sep 17 00:00:00 2001 From: deepzz0 Date: Thu, 2 Mar 2017 22:47:44 +0800 Subject: [PATCH] fix out of range about MapArticels --- front.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front.go b/front.go index 1967fce..ee644d1 100644 --- a/front.go +++ b/front.go @@ -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 }