From a4b98bc2920cae80082bad2fd5a1c8300d94499a Mon Sep 17 00:00:00 2001 From: DeionSi Date: Mon, 6 May 2024 04:09:10 +0200 Subject: [PATCH] Fix refreshing not clearing the list fully (#41) * Fix refreshing not clearing the list fully * Another occurence of the same issue --- UI/renderer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/UI/renderer.js b/UI/renderer.js index d91c4b5..0e45906 100644 --- a/UI/renderer.js +++ b/UI/renderer.js @@ -25,7 +25,7 @@ function refreshSerialPorts() select = document.getElementById('portsSelect'); //Clear the current options - for (i = 0; i <= select.options.length; i++) + while (select.options.length > 0) { select.remove(0); //Always 0 index (As each time an item is removed, everything shuffles up 1 place) } @@ -268,7 +268,7 @@ function requestPatternList() //Clear the existing list var select = document.getElementById('patternSelect') - for (i = 0; i <= select.options.length; i++) + while(select.options.length > 0) { select.remove(0); //Always 0 index (As each time an item is removed, everything shuffles up 1 place) }