DEV: Fix a use-after-destroy issue (#20948)

This commit is contained in:
Jarek Radosz 2023-04-04 01:29:27 +02:00 committed by GitHub
parent c00d17535f
commit 3b28d03780
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -237,13 +237,17 @@ export default Component.extend({
this._similarTopicsMessage = message; this._similarTopicsMessage = message;
composer.store.find("similar-topic", { title, raw }).then((topics) => { composer.store.find("similar-topic", { title, raw }).then((topics) => {
if (this.isDestroying || this.isDestroyed) {
return;
}
similarTopics.clear(); similarTopics.clear();
similarTopics.pushObjects(topics.get("content")); similarTopics.pushObjects(topics.get("content"));
if (similarTopics.get("length") > 0) { if (similarTopics.get("length") > 0) {
message.set("similarTopics", similarTopics); message.set("similarTopics", similarTopics);
this.send("popup", message); this.send("popup", message);
} else if (message && !(this.isDestroyed || this.isDestroying)) { } else if (message) {
this.send("hideMessage", message); this.send("hideMessage", message);
} }
}); });