Skip to content

Commit

Permalink
[release-2.0] Avoid NPE problems when querying the list of posts in t…
Browse files Browse the repository at this point in the history
…he console (#3075)

This is an automated cherry-pick of #3068

/assign ruibaby

```release-note
None
```
  • Loading branch information
halo-dev-bot authored Dec 29, 2022
1 parent 3800bc5 commit c4d435e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/main/java/run/halo/app/content/impl/PostServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Predicate<Post> postListPredicate(PostQuery query) {
Predicate<Post> paramPredicate = post ->
contains(query.getCategories(), post.getSpec().getCategories())
&& contains(query.getTags(), post.getSpec().getTags())
&& contains(query.getContributors(), post.getStatus().getContributors());
&& contains(query.getContributors(), post.getStatusOrDefault().getContributors());

String keyword = query.getKeyword();
if (keyword != null) {
Expand Down Expand Up @@ -159,7 +159,7 @@ private Mono<ListedPost> getListedPost(Post post) {
})
.flatMap(lp -> setTags(post.getSpec().getTags(), lp))
.flatMap(lp -> setCategories(post.getSpec().getCategories(), lp))
.flatMap(lp -> setContributors(post.getStatus().getContributors(), lp))
.flatMap(lp -> setContributors(post.getStatusOrDefault().getContributors(), lp))
.flatMap(lp -> setOwner(post.getSpec().getOwner(), lp));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.dao.OptimisticLockingFailureException;
import org.springframework.security.core.context.ReactiveSecurityContextHolder;
import org.springframework.security.core.context.SecurityContext;
Expand Down Expand Up @@ -61,8 +60,6 @@ public class SinglePageServiceImpl implements SinglePageService {

private final CounterService counterService;

private final ApplicationContext applicationContext;

@Override
public Mono<ListResult<ListedSinglePage>> list(SinglePageQuery query) {
Comparator<SinglePage> comparator =
Expand Down

0 comments on commit c4d435e

Please sign in to comment.