fixup: section numbering when cutAt is -1

This commit is contained in:
tophf 2020-11-08 08:36:59 +03:00
parent 6801d8804e
commit 91d6959a17

View File

@ -252,7 +252,7 @@ function MozSectionWidget(
} }
} }
// renumber // renumber
for (let i = cutAt, {sections} = finder, sec; (sec = sections[i++]);) { for (let i = Math.max(0, cutAt), {sections} = finder, sec; (sec = sections[i++]);) {
if (!toDelay.includes(sec)) { if (!toDelay.includes(sec)) {
const data = $(C_LABEL, sec.widget.node).dataset; const data = $(C_LABEL, sec.widget.node).dataset;
if (data.index !== `${i}`) data.index = `${i}`; if (data.index !== `${i}`) data.index = `${i}`;