diff --git a/Global_Indexer/ClassIndexFunctions.vb b/Global_Indexer/ClassIndexFunctions.vb index 8d4987e..71d36c0 100644 --- a/Global_Indexer/ClassIndexFunctions.vb +++ b/Global_Indexer/ClassIndexFunctions.vb @@ -10,12 +10,14 @@ Public Class ClassIndexFunctions Filename = Filename.Replace("'", "''") End If - Try - oHash = FILESYSTEM.GetChecksum(Filename) - Catch ex As Exception - LOGGER.Error(ex) - oHash = "" - End Try + ' If file cannot be accessed, checksum cannot be generated + ' In this case, the file should be treated as not yet existing + oHash = FILESYSTEM.GetChecksum(Filename) + + If oHash Is Nothing Then + LOGGER.Warn("Checksum for file {0} could not be generated. Treating as new file.", Filename) + Return Nothing + End If oSQL = "SELECT * FROM TBGI_FILES_USER WHERE UPPER(FILE_HASH) = UPPER('" & oHash & "') AND WORKED = 0 ORDER BY ADDED_WHEN" Dim oResult As DataTable = ClassDatabase.Return_Datatable_CS(oSQL, MyConnectionString, True)