aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/util.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-03-02 11:18:09 +0200
committersiikamiika <siikamiika@users.noreply.github.com>2020-03-02 11:18:09 +0200
commite0edb30efd51ac18167880d77c2dea11c73a1bfc (patch)
tree2601a53a7ad8f5defb83e3f0583907fd1a8ada9e /ext/bg/js/util.js
parentbd48d2f919e1387063c66ef91c40ec86a1131118 (diff)
fix Backend prepare issues in settings
Diffstat (limited to 'ext/bg/js/util.js')
-rw-r--r--ext/bg/js/util.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js
index 5ce4b08c..79c6af06 100644
--- a/ext/bg/js/util.js
+++ b/ext/bg/js/util.js
@@ -73,7 +73,11 @@ function utilStringHashCode(string) {
}
function utilBackend() {
- return chrome.extension.getBackgroundPage().yomichanBackend;
+ const backend = chrome.extension.getBackgroundPage().yomichanBackend;
+ if (!backend.isPrepared) {
+ throw new Error('Backend not ready yet');
+ }
+ return backend;
}
async function utilAnkiGetModelNames() {