feat: 解决无数据时NPE问题

This commit is contained in:
josxy 2021-04-22 01:16:36 +08:00
parent 159951061e
commit a16c85ca76
2 changed files with 2 additions and 2 deletions

View File

@ -39,7 +39,7 @@ public class TagShowController {
@PathVariable Long id, Pageable pageable) {
List<Tag> tags = tagServiceImpl.ListTagTop(10000);
if (id == -1){
if (id == -1 && tags.size() > 0) {
id = tags.get(0).getId();
}
BlogQuery blogQuery = new BlogQuery();

View File

@ -36,7 +36,7 @@ public class TypeShowController {
@PathVariable Long id, Pageable pageable) {
List<Type> types = typeServiceImpl.listTypeTop(10000);
if (id == -1){
if (id == -1 && types.size() > 0){
id = types.get(0).getId();
}
BlogQuery blogQuery = new BlogQuery();