Fix bug of empty result
This commit is contained in:
parent
f984c69100
commit
23125bea5e
@ -89,7 +89,12 @@ func landingPage(c *gin.Context) {
|
|||||||
}}},
|
}}},
|
||||||
})
|
})
|
||||||
defer storageDisconnect(client)
|
defer storageDisconnect(client)
|
||||||
numCards := counts[0]["count"].(int32)
|
|
||||||
|
// Catch index error on no results
|
||||||
|
var numCards int32
|
||||||
|
if len(counts) != 0 {
|
||||||
|
numCards = counts[0]["count"].(int32)
|
||||||
|
}
|
||||||
|
|
||||||
c.HTML(http.StatusOK, "index.tmpl", gin.H{
|
c.HTML(http.StatusOK, "index.tmpl", gin.H{
|
||||||
"title": "Serra",
|
"title": "Serra",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user