fix stupid bug

This commit is contained in:
ZXMushroom63 2024-12-23 20:19:23 +08:00
parent b67cb8ec3a
commit cdd427ed20
2 changed files with 10 additions and 2 deletions

View File

@ -63,7 +63,11 @@ globalThis.modapi_modloader = "(" + (() => {
globalThis.addFileMod = async function addFileMod(mod, textContents) {
const mods = await getMods();
mods.push(mod);
if (mods.includes(mod)) {
await removeMod(mods.indexOf(mod));
} else {
mods.push(mod);
}
await saveMods(mods);
const db = await getDatabase();

View File

@ -265,7 +265,11 @@ globalThis.modapi_postinit = "(" + (() => {
"class": item || null,
"hasMeta": !!item,
"instanceOf": function (object) {
return ModAPI.hooks._teavm.$rt_isInstance(object, item || null);
try {
return ModAPI.hooks._teavm.$rt_isInstance(object, item || null);
} catch {
return false;
}
},
"compiledName": compiledName
}