mirror of
https://github.com/eaglerforge/EaglerForgeInjector
synced 2025-07-25 07:01:20 -09:00
Prevent crashes from incorrect metafunction use
This commit is contained in:
parent
6d710b3ece
commit
661c3d9b92
@ -27,7 +27,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ModAPI.meta.title = function (title) {
|
ModAPI.meta.title = function (title) {
|
||||||
if (document.currentScript.getAttribute("data-isMod") !== "true") {
|
if (!document.currentScript || document.currentScript.getAttribute("data-isMod") !== "true") {
|
||||||
return console.log("[ModAPIMeta] Cannot set meta for non-mod script.");
|
return console.log("[ModAPIMeta] Cannot set meta for non-mod script.");
|
||||||
}
|
}
|
||||||
if (!document.currentScript.hasAttribute("data-hash")) {
|
if (!document.currentScript.hasAttribute("data-hash")) {
|
||||||
@ -36,7 +36,7 @@
|
|||||||
ModAPI.meta._titleMap[document.currentScript.getAttribute("data-hash")] = limitSize(title, 14);
|
ModAPI.meta._titleMap[document.currentScript.getAttribute("data-hash")] = limitSize(title, 14);
|
||||||
}
|
}
|
||||||
ModAPI.meta.icon = function (iconSrc) {
|
ModAPI.meta.icon = function (iconSrc) {
|
||||||
if (document.currentScript.getAttribute("data-isMod") !== "true") {
|
if (!document.currentScript || document.currentScript.getAttribute("data-isMod") !== "true") {
|
||||||
return console.log("[ModAPIMeta] Cannot set meta for non-mod script.");
|
return console.log("[ModAPIMeta] Cannot set meta for non-mod script.");
|
||||||
}
|
}
|
||||||
if (!document.currentScript.hasAttribute("data-hash")) {
|
if (!document.currentScript.hasAttribute("data-hash")) {
|
||||||
@ -45,7 +45,7 @@
|
|||||||
ModAPI.meta._iconMap[document.currentScript.getAttribute("data-hash")] = iconSrc;
|
ModAPI.meta._iconMap[document.currentScript.getAttribute("data-hash")] = iconSrc;
|
||||||
}
|
}
|
||||||
ModAPI.meta.credits = function (cd) {
|
ModAPI.meta.credits = function (cd) {
|
||||||
if (document.currentScript.getAttribute("data-isMod") !== "true") {
|
if (!document.currentScript || document.currentScript.getAttribute("data-isMod") !== "true") {
|
||||||
return console.log("[ModAPIMeta] Cannot set meta for non-mod script.");
|
return console.log("[ModAPIMeta] Cannot set meta for non-mod script.");
|
||||||
}
|
}
|
||||||
if (!document.currentScript.hasAttribute("data-hash")) {
|
if (!document.currentScript.hasAttribute("data-hash")) {
|
||||||
@ -54,7 +54,7 @@
|
|||||||
ModAPI.meta._developerMap[document.currentScript.getAttribute("data-hash")] = limitSize(cd, 16);
|
ModAPI.meta._developerMap[document.currentScript.getAttribute("data-hash")] = limitSize(cd, 16);
|
||||||
}
|
}
|
||||||
ModAPI.meta.description = function (desc) {
|
ModAPI.meta.description = function (desc) {
|
||||||
if (document.currentScript.getAttribute("data-isMod") !== "true") {
|
if (!document.currentScript || document.currentScript.getAttribute("data-isMod") !== "true") {
|
||||||
return console.log("[ModAPIMeta] Cannot set meta for non-mod script.");
|
return console.log("[ModAPIMeta] Cannot set meta for non-mod script.");
|
||||||
}
|
}
|
||||||
if (!document.currentScript.hasAttribute("data-hash")) {
|
if (!document.currentScript.hasAttribute("data-hash")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user