Skip to content
Permalink
Browse files

module_search.js / start_search: Check that currentTab is != null

  • Loading branch information
Tobias Klein
Tobias Klein committed Dec 2, 2019
1 parent 4b348fd commit 44e7b4424304d46b4056fedbee139556542dfb9c
Showing with 23 additions and 20 deletions.
  1. +23 −20 app/bible_browser/module_search.js
@@ -155,30 +155,33 @@ class ModuleSearch {
//console.log("Starting search for " + this.currentSearchTerm + " on tab " + tabIndex);

var currentTab = bible_browser_controller.tab_controller.getTab(tabIndex);
var currentBibleTranslationId = currentTab.getBibleTranslationId();
var isPhrase = currentTab.getSearchOptions()['exactPhrase'];
var isCaseSensitive = currentTab.getSearchOptions()['caseSensitive'];

var searchType = "multiWord";
if (isPhrase) {
searchType = "phrase";
}
if (currentTab != null) {
var currentBibleTranslationId = currentTab.getBibleTranslationId();
var isPhrase = currentTab.getSearchOptions()['exactPhrase'];
var isCaseSensitive = currentTab.getSearchOptions()['caseSensitive'];

await nsi.getModuleSearchResults(currentBibleTranslationId,
this.currentSearchTerm,
searchType,
isCaseSensitive).then(async (searchResults) => {

//console.log("Got " + searchResults.length + " from Sword");
bible_browser_controller.tab_controller.getTab(tabIndex).setSearchResults(searchResults);
});
var searchType = "multiWord";
if (isPhrase) {
searchType = "phrase";
}

var requestedBookId = -1; // all books requested
if (this.searchResultsExceedPerformanceLimit(tabIndex)) {
requestedBookId = 0; // no books requested - only list headers at first
}
await nsi.getModuleSearchResults(currentBibleTranslationId,
this.currentSearchTerm,
searchType,
isCaseSensitive).then(async (searchResults) => {

//console.log("Got " + searchResults.length + " from Sword");
currentTab.setSearchResults(searchResults);
});

var requestedBookId = -1; // all books requested
if (this.searchResultsExceedPerformanceLimit(tabIndex)) {
requestedBookId = 0; // no books requested - only list headers at first
}

await this.renderCurrentSearchResults(requestedBookId, tabIndex);
await this.renderCurrentSearchResults(requestedBookId, tabIndex);
}
}

async renderCurrentSearchResults(requestedBookId=-1, tabIndex=undefined, target=undefined) {

0 comments on commit 44e7b44

Please sign in to comment.
You can’t perform that action at this time.