fix nullpointer
This commit is contained in:
parent
d3b2a95472
commit
95376a2369
@ -95,10 +95,16 @@ public class CommentManager {
|
||||
|
||||
JPAQuery<Long> countQuery = query.clone().select(qComment.id.countDistinct());
|
||||
|
||||
Long count = countQuery.fetchOne();
|
||||
|
||||
if (count == null) {
|
||||
count = 0L;
|
||||
}
|
||||
|
||||
return new PageImpl<Comment>(query
|
||||
.orderBy(new OrderSpecifier<>(
|
||||
asc ? com.querydsl.core.types.Order.ASC : com.querydsl.core.types.Order.DESC, qComment.created))
|
||||
.limit(size).offset(page * size).fetch(), PageRequest.of(page, size, sort), countQuery.fetchOne());
|
||||
.limit(size).offset(page * size).fetch(), PageRequest.of(page, size, sort), count);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -414,10 +414,16 @@ public class EntryManager {
|
||||
|
||||
JPAQuery<Long> countQuery = query.clone().select(qEntry.id.countDistinct());
|
||||
|
||||
Long count = countQuery.fetchOne();
|
||||
|
||||
if (count == null) {
|
||||
count = 0L;
|
||||
}
|
||||
|
||||
return new PageImpl<Entry>(query
|
||||
.orderBy(new OrderSpecifier<>(
|
||||
asc ? com.querydsl.core.types.Order.ASC : com.querydsl.core.types.Order.DESC, qEntry.created))
|
||||
.limit(size).offset(page * size).fetch(), PageRequest.of(page, size, sort), countQuery.fetchOne());
|
||||
.limit(size).offset(page * size).fetch(), PageRequest.of(page, size, sort), count);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user