[FIX] mail: no crash on call from another device
Before this commit, when in a call on another device and then calling from another device, there might be the following traceback: ``` TypeError: Cannot read properties of undefined (reading 'lastObservedRecords') at ModelManager.removeListener at RelationSet.delete at RelationSet.clear at ModelField._setRelationReplace at ModelField.parseAndExecuteCommands at ModelManager._update at Listener.onChange at ModelManager._notifyListenersInUpdateCycle at ModelManager._flushUpdateCycle at ModelManager.update ``` This is caused by removing a non-existent listener on a field, very likely related to a relational field from the call being terminated. This commit fixes the issue by silently skipping removal of listener when it's undefined. Task-3241562 closes odoo/odoo#116192 X-original-commit: 24af22187ce8401d925edb1dda02652f993c7394 Signed-off-by: Louis Wicket (wil) <wil@odoo.com>
This commit is contained in:
@@ -311,6 +311,9 @@ export class ModelManager {
|
||||
* @param {Listener} listener
|
||||
*/
|
||||
removeListener(listener) {
|
||||
if (!listener) {
|
||||
return;
|
||||
}
|
||||
this._listeners.delete(listener);
|
||||
this._listenersToNotifyInUpdateCycle.delete(listener);
|
||||
this._listenersToNotifyAfterUpdateCycle.delete(listener);
|
||||
|
||||
Reference in New Issue
Block a user