Fix bug of empty result

This commit is contained in:
Florian Baumann 2024-03-19 11:39:08 +01:00
parent f984c69100
commit 23125bea5e

View File

@ -89,7 +89,12 @@ func landingPage(c *gin.Context) {
}}},
})
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{
"title": "Serra",