(search) Fix NPE in layout selection

This commit is contained in:
Viktor Lofgren 2023-12-28 19:34:46 +01:00
parent 775974d5ec
commit 70f338c3de

View File

@ -247,13 +247,13 @@ public class SearchSiteInfoService {
public String getLayout() {
// My CSS is too weak to handle this in CSS alone, so I guess we're doing layout in Java...
if (similar.size() < 25) {
if (similar != null && similar.size() < 25) {
return "lopsided";
}
else if (!feed.items().isEmpty()) {
else if (feed != null && !feed.items().isEmpty()) {
return "lopsided";
}
else if (!samples.isEmpty()) {
else if (samples != null && !samples.isEmpty()) {
return "lopsided";
}
else {