diff --git a/LunaHook/resource/lunajspatch.js b/LunaHook/resource/lunajspatch.js index 17bdc79..f2bd80b 100644 --- a/LunaHook/resource/lunajspatch.js +++ b/LunaHook/resource/lunajspatch.js @@ -34,14 +34,19 @@ function Electronhook() { } function retryinject(times){ if(times==0)return; - if(window.tyrano && tyrano.plugin){ - Electronhook(); + try{ + if(window.tyrano && tyrano.plugin){ + Electronhook(); + } + else if(window.Utils && Utils.RPGMAKER_NAME){ + NWjshook(); + } + else{ + setTimeout(retryinject,3000,times-1); + } } - else if(window.Utils && Utils.RPGMAKER_NAME){ - NWjshook(); - } - else{ - setTimeout(retryinject,3000,times-1); + catch{ + //非主线程,甚至没有window对象,会弹窗报错 } } setTimeout(retryinject,3000,3); \ No newline at end of file