go-admin
go-admin copied to clipboard
[Question] 1.2.9升级到1.2.10出现runtime error: invalid memory address or nil pointer dereference
问题描述 [详细地描述问题,让大家都能理解]
升级到 1.2.10 访问谋个路由时出现空指针错误,查看错误,也不知道哪里出错
示例代码 [如果有必要,展示代码,线上示例,或仓库]
其他信息 [如截图等其他信息可以贴在这里]
2020-05-18T01:43:36.034Z logger/logger.go:361 [GoAdmin] 200 GET /admin/info/statisticsorders
2020-05-18T01:43:36.036Z ERROR logger/logger.go:316 runtime error: invalid memory address or nil pointer dereference
2020-05-18T01:43:36.036Z ERROR logger/logger.go:316 goroutine 21 [running]:
runtime/debug.Stack(0xc000210050, 0xcc9e02, 0x0)
C:/Go/src/runtime/debug/stack.go:24 +0x9d
github.com/GoAdminGroup/go-admin/plugins/admin/controller.(*Handler).GlobalDeferHandler(0xc0000ba2a0, 0xc0004904c0)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/plugins/admin/controller/handler.go:29 +0xc6
panic(0xcc9e60, 0x1b87050)
C:/Go/src/runtime/panic.go:969 +0x166
github.com/GoAdminGroup/go-admin/template/types.FieldDisplay.ToDisplay(0x0, 0x0, 0x0, 0x0, 0x1812319, 0x1, 0x1812319, 0x1, 0xc000404b70, 0x0, ...)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/template/types/display.go:36 +0x4c
github.com/GoAdminGroup/go-admin/plugins/admin/modules/table.DefaultTable.getTempModelData(0xc0000a8180, 0xdbb855, 0x5, 0xdbde5a, 0x7, 0x0, 0x0, 0x0, 0xc000404b70, 0xdb9978, ...)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/plugins/admin/modules/table/default.go:287 +0x35b
github.com/GoAdminGroup/go-admin/plugins/admin/modules/table.DefaultTable.getDataFromDatabase(0xc0000a8180, 0xdbb855, 0x5, 0xdbde5a, 0x7, 0x0, 0x0, 0x0, 0xdb9978, 0x1, ...)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/plugins/admin/modules/table/default.go:504 +0xe8c
github.com/GoAdminGroup/go-admin/plugins/admin/modules/table.DefaultTable.GetData(0xc0000a8180, 0xdbb855, 0x5, 0xdbde5a, 0x7, 0x0, 0x0, 0x0, 0xdb9978, 0x1, ...)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/plugins/admin/modules/table/default.go:115 +0x97d
github.com/GoAdminGroup/go-admin/plugins/admin/controller.(*Handler).showTableData(0xc0000ba2a0, 0xc0004904c0, 0xc00003e461, 0x10, 0xdb9978, 0x1, 0x1, 0xdf1f14, 0x2, 0xa, ...)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/plugins/admin/controller/show.go:61 +0x204
github.com/GoAdminGroup/go-admin/plugins/admin/controller.(*Handler).showTable(0xc0000ba2a0, 0xc0004904c0, 0xc00003e461, 0x10, 0xdb9978, 0x1, 0x1, 0xdf1f14, 0x2, 0xa, ...)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/plugins/admin/controller/show.go:91 +0xd8
github.com/GoAdminGroup/go-admin/plugins/admin/controller.(*Handler).ShowInfo(0xc0000ba2a0, 0xc0004904c0)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/plugins/admin/controller/show.go:51 +0x319
github.com/GoAdminGroup/go-admin/context.(*Context).Next(0xc0004904c0)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/context/context.go:98 +0x44
github.com/GoAdminGroup/go-admin/plugins/admin/modules/guard.(*Guard).CheckPrefix(0xc0000b81a0, 0xc0004904c0)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/plugins/admin/modules/guard/guard.go:46 +0x18a
github.com/GoAdminGroup/go-admin/context.(*Context).Next(0xc0004904c0)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/context/context.go:98 +0x44
github.com/GoAdminGroup/go-admin/modules/auth.(*Invoker).Middleware.func1(0xc0004904c0)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/modules/auth/middleware.go:124 +0x343
github.com/GoAdminGroup/go-admin/context.(*Context).Next(0xc0004904c0)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/context/context.go:98 +0x44
github.com/GoAdminGroup/go-admin/plugins/admin.(*Admin).globalErrorHandler(0xc0000b8040, 0xc0004904c0)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/plugins/admin/router.go:88 +0x7a
github.com/GoAdminGroup/go-admin/context.(*Context).Next(0xc0004904c0)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/context/context.go:98 +0x44
github.com/GoAdminGroup/go-admin/adapter/gin.(*Gin).AddHandler.func1(0xc0001ca0f0)
D:/go/pkg/mod/github.com/!go!admin!group/[email protected]/adapter/gin/gin.go:89 +0x2a3
github.com/gin-gonic/gin.(*Context).Next(0xc0001ca0f0)
D:/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 +0x3b
github.com/gin-gonic/gin.RecoveryWithWriter.func1(0xc0001ca0f0)
D:/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:83 +0x60
github.com/gin-gonic/gin.(*Context).Next(0xc0001ca0f0)
D:/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 +0x3b
github.com/gin-gonic/gin.LoggerWithConfig.func1(0xc0001ca0f0)
D:/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:241 +0xe1
github.com/gin-gonic/gin.(*Context).Next(0xc0001ca0f0)
D:/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:161 +0x3b
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest(0xc0003b6280, 0xc0001ca0f0)
D:/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:409 +0x666
github.com/gin-gonic/gin.(*Engine).ServeHTTP(0xc0003b6280, 0x12adf20, 0xc0004ac380, 0xc0004bc500)
D:/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:367 +0x14d
net/http.serverHandler.ServeHTTP(0xc0004ac000, 0x12adf20, 0xc0004ac380, 0xc0004bc500)
C:/Go/src/net/http/server.go:2807 +0xa3
net/http.(*conn).serve(0xc0004a1680, 0x12b07a0, 0xc000216480)
C:/Go/src/net/http/server.go:1895 +0x86c
created by net/http.(*Server).Serve
C:/Go/src/net/http/server.go:2933 +0x35c
@smirkcat 升级到最新版本试下。GoAdmin v1.2.11 themes v0.0.33
在一个 table view 不显示 id 的情况下,也会报这个错误
@sunzhongwei @smirkcat 问题较久,新版本若有类似问题可以再打开,先关闭。