1
0
mirror of https://github.com/axllent/mailpit.git synced 2025-01-28 03:56:50 +02:00

Fix: Prevent runtime error when calculating total messages size of empty table (#263)

This commit is contained in:
Ralph Slooten 2024-03-10 07:48:44 +13:00
parent bdea197a0f
commit d1d0ce4737

View File

@ -51,7 +51,7 @@ func getDeletedSize() int64 {
// The total raw non-compressed messages size in bytes of all messages in the database
func totalMessagesSize() int64 {
var result int64
var result sql.NullInt64
err := sqlf.From("mailbox").
Select("SUM(Size)").To(&result).
QueryAndClose(nil, db, func(row *sql.Rows) {})
@ -60,7 +60,7 @@ func totalMessagesSize() int64 {
return 0
}
return result
return result.Int64
}
// AddDeletedSize will add the value to the DeletedSize setting