Skip to content
This repository
Browse code

Merge pull request #20 from mattoshry/master

handle case where specified listener is not registered in call to unregisterListener
  • Loading branch information...
commit 71c9914d5db9f64e377f1846397a5b2b007f4e84 2 parents 25d4826 + 1b0f135
Jacob Beard authored June 06, 2013

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. 8  lib/core/scxml/SCXML.js
8  lib/core/scxml/SCXML.js
@@ -560,7 +560,13 @@ SCXMLInterpreter.prototype = {
560 560
 
561 561
     /** @expose */
562 562
     unregisterListener : function(listener){
563  
-        return this._listeners.splice(this._listeners.indexOf(listener),1);
  563
+        var retval;
  564
+        var index = this._listeners.indexOf(listener);
  565
+        if (index >= 0) {
  566
+          retval = this._listeners.splice(index,1);
  567
+        }
  568
+
  569
+        return retval;
564 570
     }
565 571
 
566 572
 };

0 notes on commit 71c9914

Please sign in to comment.
Something went wrong with that request. Please try again.