diff --git a/lib/app/lower.js b/lib/app/lower.js index a2bc2b286..1f7fb071d 100644 --- a/lib/app/lower.js +++ b/lib/app/lower.js @@ -79,7 +79,7 @@ module.exports = function lower(options, cb) { // the onClose event possibly being called multiple times (because you can't tell // socket.io to close without it trying to close the http server). If we're piggybacking // we'll call sails.io.close in the main "shutdownHTTP" code below. - if (!_.isObject(sails.hooks) || !sails.hooks.sockets || (sails.io.httpServer && sails.hooks.http.server === sails.io.httpServer)) { + if (!_.isObject(sails.hooks) || !sails.hooks.sockets || (sails.io && sails.io.httpServer && sails.hooks.http.server === sails.io.httpServer)) { return cb(); }