From b2e2743f64cd1d57f5848e8e093703ac313774ac Mon Sep 17 00:00:00 2001 From: Raccoon Date: Sat, 31 Jul 2021 20:18:51 +0800 Subject: [PATCH] fix: may referernce out of bound index in clearDuplicatedHistory Signed-off-by: Raccoon --- public/js/history.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/history.js b/public/js/history.js index da39f095..1f109ad0 100644 --- a/public/js/history.js +++ b/public/js/history.js @@ -59,7 +59,7 @@ export function clearDuplicatedHistory (notehistory) { const newId = newnotehistory[j].id.replace(/=+$/, '') if (id === newId || notehistory[i].id === newnotehistory[j].id || !notehistory[i].id || !newnotehistory[j].id) { const time = (typeof notehistory[i].time === 'number' ? moment(notehistory[i].time) : moment(notehistory[i].time, 'MMMM Do YYYY, h:mm:ss a')) - const newTime = (typeof newnotehistory[i].time === 'number' ? moment(newnotehistory[i].time) : moment(newnotehistory[i].time, 'MMMM Do YYYY, h:mm:ss a')) + const newTime = (typeof newnotehistory[j].time === 'number' ? moment(newnotehistory[j].time) : moment(newnotehistory[j].time, 'MMMM Do YYYY, h:mm:ss a')) if (time >= newTime) { newnotehistory[j] = notehistory[i] }