1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-02-12 11:01:52 +00:00

Safety check if plugin actually has exports before attempting to export functions

This commit is contained in:
Ryan Blenis 2019-11-24 19:19:46 -05:00
parent 25786df952
commit d3cdd0703b

View file

@ -66,8 +66,10 @@ module.exports.pluginHandler = function (parent) {
for (const p of Object.keys(obj.plugins)) {
str += ' obj.' + p + ' = {};\r\n';
for (const l of Object.values(obj.exports[p])) {
str += ' obj.' + p + '.' + l + ' = ' + obj.plugins[p][l].toString() + '\r\n';
if (Array.isArray(obj.exports[p])) {
for (const l of Object.values(obj.exports[p])) {
str += ' obj.' + p + '.' + l + ' = ' + obj.plugins[p][l].toString() + '\r\n';
}
}
}