From 48497b7b0e821f54a03a58f0861bd3a8d9ac49a0 Mon Sep 17 00:00:00 2001 From: Andrew Stewart Date: Thu, 4 Sep 2014 11:14:47 -0700 Subject: [PATCH] Default to no-op callbacks for #halt methods --- lib/cylon.js | 1 + lib/robot.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/cylon.js b/lib/cylon.js index 65e5bd2..f99e0f7 100644 --- a/lib/cylon.js +++ b/lib/cylon.js @@ -105,6 +105,7 @@ Cylon.config = function(key) { // // Returns nothing Cylon.halt = function halt(callback) { + callback = callback || function() {} // if robots can't shut down quickly enough, forcefully self-terminate var timeout = Config.halt_timeout || 3000 Utils.after(timeout, callback); diff --git a/lib/robot.js b/lib/robot.js index 22fba1a..bcb6fa6 100644 --- a/lib/robot.js +++ b/lib/robot.js @@ -285,6 +285,8 @@ Robot.prototype.startDevices = function(callback) { // // Returns nothing Robot.prototype.halt = function(callback) { + callback = callback || function() {}; + var fns = []; for (var d in this.devices) {