diff --git a/lib/utils.js b/lib/utils.js index 166cbddc..352a02fb 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -70,7 +70,7 @@ var prepareValue = function (val, seen) { } function prepareObject (val, seen) { - if (val.toPostgres && typeof val.toPostgres === 'function') { + if (val && typeof val.toPostgres === 'function') { seen = seen || [] if (seen.indexOf(val) !== -1) { throw new Error('circular reference detected while preparing "' + val + '" for query')