Permalink
Browse files

Merge pull request #20 from mattoshry/master

handle case where specified listener is not registered in call to unregisterListener
  • Loading branch information...
jbeard4 committed Jun 6, 2013
2 parents 25d4826 + 1b0f135 commit 71c9914d5db9f64e377f1846397a5b2b007f4e84
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/core/scxml/SCXML.js
View
@@ -560,7 +560,13 @@ SCXMLInterpreter.prototype = {
/** @expose */
unregisterListener : function(listener){
- return this._listeners.splice(this._listeners.indexOf(listener),1);
+ var retval;
+ var index = this._listeners.indexOf(listener);
+ if (index >= 0) {
+ retval = this._listeners.splice(index,1);
+ }
+
+ return retval;
}
};

0 comments on commit 71c9914

Please sign in to comment.