diff --git a/LunaHook/resource/lunajspatch.js b/LunaHook/resource/lunajspatch.js index fa5fb2c..1ecfb1a 100644 --- a/LunaHook/resource/lunajspatch.js +++ b/LunaHook/resource/lunajspatch.js @@ -34,16 +34,19 @@ function Electronhook() { } function retryinject(times){ if(times==0)return; - - if(window && 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 && window.Utils && Utils.RPGMAKER_NAME){ - NWjshook(); + catch(err){ + //非主线程,甚至没有window对象,会弹窗报错 } - else{ - setTimeout(retryinject,3000,times-1); - } - } setTimeout(retryinject,3000,3); \ No newline at end of file