diff options
author | Wu Cheng-Han | 2015-09-26 10:25:00 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2015-09-26 10:25:00 +0800 |
commit | 332413bcaa7e1c810f236239474d997eb5d1aa43 (patch) | |
tree | 4c80646a8cedc45f28a740cfd076f72371227e3a /public | |
parent | 3683a6dd3421a7392d728d6dd33ea452380b2154 (diff) |
Fixed if using splice in loop should always decrement index or might out of array range
Diffstat (limited to '')
-rw-r--r-- | public/js/history.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/public/js/history.js b/public/js/history.js index 10ab932f..82c145da 100644 --- a/public/js/history.js +++ b/public/js/history.js @@ -123,8 +123,10 @@ function addHistory(id, text, time, tags, notehistory) { function removeHistory(id, notehistory) { for (var i = 0; i < notehistory.length; i++) { - if (notehistory[i].id == id) + if (notehistory[i].id == id) { notehistory.splice(i, 1); + i--; + } } return notehistory; } |