From da5b134a2b15ee7b9da4bada8d7a3b2c1cf69ed1 Mon Sep 17 00:00:00 2001 From: r-ca Date: Wed, 24 Jan 2024 18:25:59 +0900 Subject: [PATCH] =?UTF-8?q?Index=E3=81=8B=E3=82=89=E6=BA=A2=E3=82=8C?= =?UTF-8?q?=E3=81=9F=E3=81=A8=E3=81=8D=E3=81=AE=E5=87=A6=E7=90=86=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java b/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java index 04a13c59..e81ffa7d 100644 --- a/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java +++ b/vcs/src/main/java/one/nem/lacerta/vcs/impl/LacertaVcsImpl.java @@ -225,7 +225,12 @@ public class LacertaVcsImpl implements LacertaVcs { if (vcsLogEntity.actionType.equals(ActionType.INSERT_PAGE.getValue())){ InsertPage insertPage = (InsertPage) JsonUtils.fromJson(vcsLogEntity.action, ActionType.INSERT_PAGE); logger.debug(TAG, "getDocumentPagePathListRev: Inserting " + insertPage.getFileName() + " at " + insertPage.getIndex()); - fileNameList.add(insertPage.getIndex(), insertPage.getFileName()); + if (fileNameList.size() <= insertPage.getIndex()) { + logger.debug(TAG, "Index out of range, appending"); + fileNameList.add(insertPage.getFileName()); + } else { + fileNameList.add(insertPage.getIndex(), insertPage.getFileName()); + } } else if (vcsLogEntity.actionType.equals(ActionType.UPDATE_PAGE.getValue())){ UpdatePage updatePage = (UpdatePage) JsonUtils.fromJson(vcsLogEntity.action, ActionType.UPDATE_PAGE); logger.debug(TAG, "getDocumentPagePathListRev: Updating " + updatePage.getFileName() + " at " + updatePage.getIndex());