From 5765604408654a8c2cf784a9f00a2964380ae666 Mon Sep 17 00:00:00 2001 From: Jon Honeycutt Date: Thu, 1 Feb 2024 18:40:31 -0600 Subject: [PATCH] Issue #1263: Desynchronized nicklist This is fallout from #1244, which moved models.delNick from using a filter to using the delete operator. The delete operator creates a sparse array that has an empty slot for the item that was deleted. This empty slot is iterable with some constructs, giving a value of undefined. These unexpected undefined values in the nicklist cause exceptions to be thrown in some situations, like when calling models.updateNickSpeak. To fix this, use Array.splice to remove elements from the nicklist, instead of the delete operator. --- src/js/models.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/models.js b/src/js/models.js index c099616..24d785e 100644 --- a/src/js/models.js +++ b/src/js/models.js @@ -160,7 +160,7 @@ models.service('models', ['$rootScope', '$filter', 'bufferResume', function($roo } for (i in group.nicks) { if (group.nicks[i].name == nick.name) { - delete group.nicks[i]; + group.nicks.splice(i, 1); break; } }