aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/juick/http/www/User.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/com/juick/http/www/User.java b/src/main/java/com/juick/http/www/User.java
index d0c1aaee..51b3965f 100644
--- a/src/main/java/com/juick/http/www/User.java
+++ b/src/main/java/com/juick/http/www/User.java
@@ -322,7 +322,8 @@ public class User {
List<Tag> tags = TagQueries.getUserTagsAll(sql, user.getUID());
int maxUsageCnt = tags.stream().map(t -> t.UsageCnt).max(Integer::max).get();
String ret = "";
- for (int i = 0; i < cnt; i++) {
+ int count = Math.min(tags.size(), cnt);
+ for (int i = 0; i < count; i++) {
String tag = Utils.encodeHTML(tags.get(i).Name);
try {
tag = "<a href=\"./?tag=" + URLEncoder.encode(tags.get(i).Name, "UTF-8") + "\" title=\""