Fix crash when removing a listener
// FREEBIE
This commit is contained in:
parent
f7c4fd2fed
commit
75b2c9c5de
2 changed files with 12 additions and 8 deletions
|
@ -36242,10 +36242,12 @@ window.textsecure.utils = function() {
|
||||||
this.listeners = {};
|
this.listeners = {};
|
||||||
}
|
}
|
||||||
var listeners = this.listeners[eventName];
|
var listeners = this.listeners[eventName];
|
||||||
for (var i=0; i < listeners.length; ++ i) {
|
if (typeof listeners === 'object') {
|
||||||
if (listeners[i] === callback) {
|
for (var i=0; i < listeners.length; ++ i) {
|
||||||
listeners.splice(i, 1);
|
if (listeners[i] === callback) {
|
||||||
return;
|
listeners.splice(i, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.listeners[eventName] = listeners;
|
this.listeners[eventName] = listeners;
|
||||||
|
|
|
@ -59,10 +59,12 @@
|
||||||
this.listeners = {};
|
this.listeners = {};
|
||||||
}
|
}
|
||||||
var listeners = this.listeners[eventName];
|
var listeners = this.listeners[eventName];
|
||||||
for (var i=0; i < listeners.length; ++ i) {
|
if (typeof listeners === 'object') {
|
||||||
if (listeners[i] === callback) {
|
for (var i=0; i < listeners.length; ++ i) {
|
||||||
listeners.splice(i, 1);
|
if (listeners[i] === callback) {
|
||||||
return;
|
listeners.splice(i, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.listeners[eventName] = listeners;
|
this.listeners[eventName] = listeners;
|
||||||
|
|
Loading…
Reference in a new issue