From 7048110cd0b157abd6e31f91b106d6bb4d6fd6b7 Mon Sep 17 00:00:00 2001 From: Bora Alper Date: Sun, 5 Nov 2017 01:48:55 +0000 Subject: [PATCH] improved error handling in DoesTorrentExist() in persistence/sqlite3.go --- persistence/sqlite3.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/persistence/sqlite3.go b/persistence/sqlite3.go index d43583d..3e3bfd3 100644 --- a/persistence/sqlite3.go +++ b/persistence/sqlite3.go @@ -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