Explorar o código

Catch errors when `destroy` is called for already removed message

JC Brand %!s(int64=6) %!d(string=hai) anos
pai
achega
3085c5d408
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      src/headless/converse-chatboxes.js

+ 7 - 1
src/headless/converse-chatboxes.js

@@ -87,7 +87,13 @@ converse.plugins.add('converse-chatboxes', {
                     this.on('change:put', this.uploadFile, this);
                 }
                 if (this.isOnlyChatStateNotification()) {
-                    window.setTimeout(this.destroy.bind(this), 20000);
+                    window.setTimeout(() => {
+                        try {
+                            this.destroy()
+                        } catch (e) {
+                            _converse.log(e, Strophe.LogLevel.ERROR);
+                        }
+                    }, 20000);
                 }
             },