Skip to content

Node.js based forum software built for the modern web

prevent admin crashes on improperly configured plugins

psychobunnyd6570d1496a4
diff --git a/src/plugins.js b/src/plugins.js
index 2fe845a56c..28ddaae55e 100644
--- a/src/plugins.js
+++ b/src/plugins.js
@@ -268,7 +268,13 @@ var fs = require('fs'),
fs.readFile(path.join(file, 'plugin.json'), next);
},
function(configJSON, next) {
- var config = JSON.parse(configJSON);
+ try {
+ var config = JSON.parse(configJSON);
+ } catch (err) {
+ winston.warn("Plugin: " + file + " is corrupted or invalid. Please check plugin.json for errors.")
+ return next(err, null);
+ }
+
_self.isActive(config.id, function(err, active) {
if (err) next(new Error('no-active-state'));