mirror of https://github.com/status-im/codimd.git
fix: may referernce out of bound index in clearDuplicatedHistory
Signed-off-by: Raccoon <raccoon@hackmd.io>
This commit is contained in:
parent
3b1e270952
commit
b2e2743f64
|
@ -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]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue