web/DialogContainer: prevent an error after a race condition

an error is no longer thrown if several dialogs were closed while timeout was running

this should really be replaced by proper dialog management system, with each dialog having a unique id and removal happening via that id, not just array.pop()
This commit is contained in:
wukko 2025-03-17 16:47:03 +06:00
parent 5850b1ac87
commit 93ff9b62d6
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2

View File

@ -16,9 +16,14 @@
if (dialogParent) {
closing = true;
open = false;
// wait 150ms for the closing animation to finish
setTimeout(() => {
dialogParent.close();
killDialog();
// check if dialog parent is still present
if (dialogParent) {
dialogParent.close();
killDialog();
}
}, 150);
}
};