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 = {};
|
||||
}
|
||||
var listeners = this.listeners[eventName];
|
||||
for (var i=0; i < listeners.length; ++ i) {
|
||||
if (listeners[i] === callback) {
|
||||
listeners.splice(i, 1);
|
||||
return;
|
||||
if (typeof listeners === 'object') {
|
||||
for (var i=0; i < listeners.length; ++ i) {
|
||||
if (listeners[i] === callback) {
|
||||
listeners.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.listeners[eventName] = listeners;
|
||||
|
|
|
@ -59,10 +59,12 @@
|
|||
this.listeners = {};
|
||||
}
|
||||
var listeners = this.listeners[eventName];
|
||||
for (var i=0; i < listeners.length; ++ i) {
|
||||
if (listeners[i] === callback) {
|
||||
listeners.splice(i, 1);
|
||||
return;
|
||||
if (typeof listeners === 'object') {
|
||||
for (var i=0; i < listeners.length; ++ i) {
|
||||
if (listeners[i] === callback) {
|
||||
listeners.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.listeners[eventName] = listeners;
|
||||
|
|
Loading…
Reference in a new issue