adding checks

This commit is contained in:
Alekhya Reddy 2020-04-07 11:29:46 -07:00
parent 4b08c0b56b
commit c1b3686190

View File

@ -29,16 +29,15 @@ namespace Wox.Plugin.Indexer.SearchHelper
// execute the command, which returns the results as an OleDbDataReader. // execute the command, which returns the results as an OleDbDataReader.
using (WDSResults = command.ExecuteReader()) using (WDSResults = command.ExecuteReader())
{ {
while (WDSResults.Read()) if(WDSResults.HasRows)
{ {
if (!Convert.IsDBNull(WDSResults[0])) while (WDSResults.Read() && WDSResults.GetValue(0) != DBNull.Value)
{ {
var result = new SearchResult { Path = WDSResults.GetString(0) }; var result = new SearchResult { Path = WDSResults.GetString(0) };
yield return result; yield return result;
} }
} }
} }
} }
} }
} }
@ -88,6 +87,7 @@ namespace Wox.Plugin.Indexer.SearchHelper
queryHelper.QuerySorting = "System.DateModified DESC"; queryHelper.QuerySorting = "System.DateModified DESC";
} }
[STAThread]
public IEnumerable<SearchResult> Search(string keyword, string pattern = "*", int maxCount = 100) public IEnumerable<SearchResult> Search(string keyword, string pattern = "*", int maxCount = 100)
{ {
ISearchQueryHelper queryHelper; ISearchQueryHelper queryHelper;