[Patcher > Base] Refuse to patch keys which don't exist

pull/67/head
Oj18 2 years ago
parent 95b0f83795
commit fa29ca2c83

@ -79,6 +79,11 @@ const generateNewFunction = (originalFunction, id, functionName, keyName) => (fu
});
export const patch = (parent, functionName, handler, before = false) => {
if (!parent[functionName]) {
goosemod.logger.debug('patcher', 'Failed to patch as key doesn\'t exist', parent, functionName);
return () => {}; // Stub func to not break
}
if (!parent._goosemodPatcherId) {
const id = generateId();

Loading…
Cancel
Save