Skip to content

Commit c413cb8

Browse files
committed
minor stability tweak - break out if a double-call rather than passing it through
1 parent 3902f14 commit c413cb8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

espruino.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,10 @@ var Espruino;
105105
var n = 0;
106106
var cbCalled = false;
107107
var cb = function(inData) {
108-
if (cbCalled) throw new Error("Internal error in "+eventType+" processor. Callback is called TWICE.");
108+
if (cbCalled) {
109+
throw new Error("Internal error in "+eventType+" processor. Callback is called TWICE.");
110+
return;
111+
}
109112
cbCalled = true;
110113
if (n < p.length) {
111114
cbCalled = false;

0 commit comments

Comments
 (0)