Skip to content
Snippets Groups Projects
Commit 1e0faefb authored by Cédric Moreau's avatar Cédric Moreau
Browse files

Fix #302 Sanitize error

parent 82c3766c
No related branches found
No related tags found
No related merge requests found
......@@ -56,7 +56,7 @@ module.exports = function sanitize (json, contract) {
// Test json member type
let tjson = typeof json[prop];
if (~['Array', 'Object'].indexOf(t)) {
if (tjson == 'object') {
if (tjson == 'object' && json[prop] !== null) {
tjson = json[prop].length == undefined ? 'Object' : 'Array';
}
}
......@@ -87,7 +87,7 @@ module.exports = function sanitize (json, contract) {
}
}
// Recursivity
if (t == 'Object') {
if (t == 'Object' && json[prop] !== null) {
json[prop] = sanitize(json[prop], contract[prop]);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment