storage.js: Avoid to call JSON.parse with an empty string
IE11 seems not to like this..
This commit is contained in:
parent
9561057b81
commit
f11de266f4
|
@ -44,8 +44,17 @@
|
|||
}
|
||||
|
||||
if (typeof Icinga.Storage.subscribers[event.key] !== 'undefined') {
|
||||
var newValue = null,
|
||||
oldValue = null;
|
||||
if (event.newValue.length) {
|
||||
newValue = JSON.parse(event.newValue);
|
||||
}
|
||||
if (event.oldValue.length) {
|
||||
oldValue = JSON.parse(event.oldValue);
|
||||
}
|
||||
|
||||
Icinga.Storage.subscribers[event.key].forEach(function (subscriber) {
|
||||
subscriber[0].call(subscriber[1], JSON.parse(event.newValue), JSON.parse(event.oldValue), event);
|
||||
subscriber[0].call(subscriber[1], newValue, oldValue, event);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue