Skip to content

Commit

Permalink
Merge pull request #21 from electricimp/fix-attempt-to-call-null-onError
Browse files Browse the repository at this point in the history
Fixed attempt to call null onError handler
  • Loading branch information
ElectricImpSampleCode authored Nov 16, 2016
2 parents de7ef82 + af8fdfa commit 73ac0e9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Bullwinkle.class.nut
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const BULLWINKLE_WATCHDOG_TIMER = 0.5;


class Bullwinkle {
static version = [2,3,1];
static version = [2,3,2];

// The bullwinkle message
static BULLWINKLE = "bullwinkle";
Expand All @@ -46,11 +46,11 @@ class Bullwinkle {
constructor(settings = {}) {
// Initialize settings
_settings = {
"messageTimeout": ("messageTimeout" in settings) ? settings["messageTimeout"].tostring().tointeger() : 10,
"retryTimeout": ("retryTimeout" in settings) ? settings["retryTimeout"].tostring().tointeger() : 60,
"maxRetries": ("maxRetries" in settings) ? settings["maxRetries"].tostring().tointeger() : 0,
"autoRetry" : ("autoRetry" in settings) ? settings["autoRetry"] : false,
"onError" : ("onError" in settings) ? settings["onError"] : null
"messageTimeout" : ("messageTimeout" in settings) ? settings["messageTimeout"].tostring().tointeger() : 10,
"retryTimeout" : ("retryTimeout" in settings) ? settings["retryTimeout"].tostring().tointeger() : 60,
"maxRetries" : ("maxRetries" in settings) ? settings["maxRetries"].tostring().tointeger() : 0,
"autoRetry" : ("autoRetry" in settings) ? settings["autoRetry"] : false,
"onError" : ("onError" in settings) ? settings["onError"] : null
};

// Initialize out message handlers
Expand Down Expand Up @@ -404,7 +404,7 @@ class Bullwinkle {
//
// Returns: nothing
function _checkTimer(timer) {
if (timer == null && "onError" in _settings) {
if (timer == null && "onError" in _settings && _settings.onError) {
_settings.onError(BULLWINKLE_ERR_TOO_MANY_TIMERS);
}
}
Expand Down

0 comments on commit 73ac0e9

Please sign in to comment.