summaryrefslogtreecommitdiff
path: root/ext/bg/js/util.js
diff options
context:
space:
mode:
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() {