mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
crash fix
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
var async = require('async'),
|
var async = require('async'),
|
||||||
winston = require('winston'),
|
winston = require('winston'),
|
||||||
templates = require('templates.js'),
|
templates = require('templates.js'),
|
||||||
|
|
||||||
plugins = require('./plugins'),
|
plugins = require('./plugins'),
|
||||||
db = require('./database');
|
db = require('./database');
|
||||||
|
|
||||||
@@ -29,7 +29,8 @@ var async = require('async'),
|
|||||||
var widgets = data.global.concat(data.local);
|
var widgets = data.global.concat(data.local);
|
||||||
|
|
||||||
async.eachSeries(widgets, function(widget, next) {
|
async.eachSeries(widgets, function(widget, next) {
|
||||||
if (!!widget.data['registered-only'] && uid === 0) {
|
|
||||||
|
if (!widget || !widget.data || (!!widget.data['registered-only'] && uid === 0)) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +45,7 @@ var async = require('async'),
|
|||||||
body: html
|
body: html
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
rendered.push({
|
rendered.push({
|
||||||
html: html
|
html: html
|
||||||
});
|
});
|
||||||
@@ -72,7 +73,7 @@ var async = require('async'),
|
|||||||
error: 'Missing location and template data'
|
error: 'Missing location and template data'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
db.setObjectField('widgets:' + area.template, area.location, JSON.stringify(area.widgets), function(err) {
|
db.setObjectField('widgets:' + area.template, area.location, JSON.stringify(area.widgets), function(err) {
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user