Permalink
Browse files

handle case where specified listener is not registered in call to unr…

…egisterListener
  • Loading branch information...
1 parent 25d4826 commit 1b0f1358bb94d21c3d3dca03e39e7843c107465a Matt Oshry committed Jun 6, 2013
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 1b0f135

Please sign in to comment.