From 70f338c3de5936b536482bcd0de0c8cc5f352026 Mon Sep 17 00:00:00 2001 From: Viktor Lofgren Date: Thu, 28 Dec 2023 19:34:46 +0100 Subject: [PATCH] (search) Fix NPE in layout selection --- .../nu/marginalia/search/svc/SearchSiteInfoService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/services-application/search-service/src/main/java/nu/marginalia/search/svc/SearchSiteInfoService.java b/code/services-application/search-service/src/main/java/nu/marginalia/search/svc/SearchSiteInfoService.java index 290bef50..97aa69bd 100644 --- a/code/services-application/search-service/src/main/java/nu/marginalia/search/svc/SearchSiteInfoService.java +++ b/code/services-application/search-service/src/main/java/nu/marginalia/search/svc/SearchSiteInfoService.java @@ -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 {