From 06af19e1b0b47689d02295e5d7a25545e42db32f Mon Sep 17 00:00:00 2001 From: Gary Date: Sun, 28 Jan 2024 03:32:50 +0800 Subject: [PATCH] 1.fix page issue --- .../java/com/luoo/music/service/UserCollectService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/luoo_music/src/main/java/com/luoo/music/service/UserCollectService.java b/luoo_music/src/main/java/com/luoo/music/service/UserCollectService.java index 74fa3a9..bc71cae 100644 --- a/luoo_music/src/main/java/com/luoo/music/service/UserCollectService.java +++ b/luoo_music/src/main/java/com/luoo/music/service/UserCollectService.java @@ -47,10 +47,10 @@ public class UserCollectService { return Collections.emptyList(); } } - private List getPageResult(Integer pageNum, Integer pageSize, LinkedList objectIds) { - if (null != pageNum && null != pageSize && pageNum > 0 && pageSize > 0) { - return objectIds.subList((pageNum - 1) * pageSize, pageNum * pageSize); + int end = pageNum * pageSize; + if (null != pageNum && null != pageSize && pageNum > 0 && pageSize > 0 && end <= objectIds.size()) { + return objectIds.subList((pageNum - 1) * pageSize, end); } return objectIds; }