From b9be3fef1d86c89392178fd4863ce90b3f2990d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20Thomas?= Date: Wed, 17 May 2017 00:15:05 +0200 Subject: [PATCH] REST: Avoid Lucene crashes when searching for 0 documents --- .../main/java/org/libresonic/player/service/SearchService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libresonic-main/src/main/java/org/libresonic/player/service/SearchService.java b/libresonic-main/src/main/java/org/libresonic/player/service/SearchService.java index 821c7209..004a16c0 100644 --- a/libresonic-main/src/main/java/org/libresonic/player/service/SearchService.java +++ b/libresonic-main/src/main/java/org/libresonic/player/service/SearchService.java @@ -159,6 +159,8 @@ public class SearchService { int count = criteria.getCount(); result.setOffset(offset); + if (count <= 0) return result; + IndexReader reader = null; try { reader = createIndexReader(indexType);