Commit ca9e6d50 authored by Tristan Cavelier's avatar Tristan Cavelier

replicatestorage instanciation bug -> fixed

parent 154f0305
...@@ -743,22 +743,23 @@ ...@@ -743,22 +743,23 @@
function replicateStorage(spec, my) { function replicateStorage(spec, my) {
var error, priv = {}, that = my.basicStorage(spec, my); var error, priv = {}, that = my.basicStorage(spec, my);
if (typeof spec.conditions !== 'object' || if (spec.conditions !== undefined &&
Object.getPrototypeOf(spec.conditions) !== Object.prototype) { (typeof spec.conditions !== 'object' ||
Object.getPrototypeOf(spec.conditions) !== Object.prototype)) {
error = new TypeError("ReplicateStorage(): " + error = new TypeError("ReplicateStorage(): " +
"'conditions' is not of type 'object'"); "'conditions' is not of type 'object'");
} }
if (Array.isArray(spec.storage_list)) { if (!Array.isArray(spec.storage_list) || spec.storage_list.length === 0) {
error = new TypeError("ReplicateStorage(): " + error = new TypeError("ReplicateStorage(): " +
"'storage_list' is not of type 'array'"); "'storage_list' is not an array which length > 0");
} }
////////////////////////////// //////////////////////////////
// Overrides // Overrides
that.validateState = function () { that.validateState = function () {
return error && error.message; return (error || '') && error.message;
}; };
that.specToStore = function () { that.specToStore = function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment