Check for null payload before going on, refs #526

This commit is contained in:
Flavio Copes
2016-07-15 17:09:15 +02:00
parent 105d48d5c2
commit 5852eb59da
4 changed files with 48 additions and 44 deletions

View File

@@ -77,6 +77,8 @@ export class UpdatesChart extends Chart {
this.chart.on('draw', (data) => this.draw(data));
gpm.on('fetched', (response) => {
if (!response.payload) { return; }
let payload = response.payload.grav;
let missing = (response.payload.resources.total + (payload.isUpdatable ? 1 : 0)) * 100 / (response.payload.installed + (payload.isUpdatable ? 1 : 0));
let updated = 100 - missing;

View File

@@ -40,7 +40,7 @@ export default class Updates {
grav() {
let payload = this.payload.grav;
if (payload.isUpdatable) {
if (payload && payload.isUpdatable) {
let task = this.task;
let bar = '';
@@ -66,7 +66,9 @@ export default class Updates {
}
resources() {
if (!this.payload.resources.total) { return this.maintenance('hide'); }
if (!this.payload || !this.payload.resources || !this.payload.resources.total) {
return this.maintenance('hide');
}
let map = ['plugins', 'themes'];
let singles = ['plugin', 'theme'];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long