From de23b633c023aa879a856ab9edbcaced5d8742dd Mon Sep 17 00:00:00 2001 From: Thomas Braun Date: Fri, 29 Sep 2023 19:20:17 +0200 Subject: [PATCH] WB_FormulaSwitchToStimset: Avoid endless loop When we don't have any stimsets the for-loop would never finish. --- Packages/MIES/MIES_WaveBuilder.ipf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/MIES/MIES_WaveBuilder.ipf b/Packages/MIES/MIES_WaveBuilder.ipf index 90988bb103..5737633aba 100644 --- a/Packages/MIES/MIES_WaveBuilder.ipf +++ b/Packages/MIES/MIES_WaveBuilder.ipf @@ -2113,7 +2113,7 @@ Function WB_FormulaSwitchToStimset(variable channelType, string formula, STRUCT // iterate the stimset list from bottom to top, so that we replace first the shorthands // with numeric prefix and only later on the ones without numSets = DimSize(epochCombineList, ROWS) - for(i = numSets - 1; i >= 0; i -= 1) + for(i = numSets - 1; i >= 0 && numSets > 0; i -= 1) shorthand = epochCombineList[i][%Shorthand] stimset = epochCombineList[i][%stimset] stimsetSpec = LowerStr(stimset) + "?"