improved error handling in DoesTorrentExist() in persistence/sqlite3.go

This commit is contained in:
Bora Alper 2017-11-05 01:48:55 +00:00
parent ddd0b15b69
commit 7048110cd0

View File

@ -58,6 +58,9 @@ func (db *sqlite3Database) DoesTorrentExist(infoHash []byte) (bool, error) {
// If rows.Next() returns true, meaning that the torrent is in the database, return true; else
// return false.
exists := rows.Next()
if !exists && rows.Err() != nil {
return false, err
}
if err = rows.Close(); err != nil {
return false, err