kunfei 3 年之前
父节点
当前提交
abeee8acf9
共有 1 个文件被更改,包括 3 次插入 和 1 次删除
  1. 3 1
      app/src/main/java/io/legado/app/data/entities/BaseSource.kt

+ 3 - 1
app/src/main/java/io/legado/app/data/entities/BaseSource.kt

@@ -236,7 +236,9 @@ interface BaseSource : JsExtensions {
         bindings["cookie"] = CookieStore
         bindings["cookie"] = CookieStore
         bindings["cache"] = CacheManager
         bindings["cache"] = CacheManager
         val scope = SCRIPT_ENGINE.getRuntimeScope(SCRIPT_ENGINE.getScriptContext(bindings))
         val scope = SCRIPT_ENGINE.getRuntimeScope(SCRIPT_ENGINE.getScriptContext(bindings))
-        scope.prototype = getShareScope()
+        getShareScope()?.let {
+            scope.prototype = it
+        }
         return SCRIPT_ENGINE.eval(jsStr, scope)
         return SCRIPT_ENGINE.eval(jsStr, scope)
     }
     }