From 48af5160df4c1400204650f7000cb04d5c643659 Mon Sep 17 00:00:00 2001 From: rr- Date: Mon, 15 Aug 2016 18:04:40 +0200 Subject: [PATCH] server/search: fix negative offsets causing ISE --- server/szurubooru/search/executor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/szurubooru/search/executor.py b/server/szurubooru/search/executor.py index 7f55fcee..a4b0d44a 100644 --- a/server/szurubooru/search/executor.py +++ b/server/szurubooru/search/executor.py @@ -81,7 +81,7 @@ class Executor(object): filter_query = filter_query.options(sqlalchemy.orm.lazyload('*')) filter_query = self._prepare_db_query(filter_query, search_query, True) entities = filter_query \ - .offset((page - 1) * page_size) \ + .offset(max(page - 1, 0) * page_size) \ .limit(page_size) \ .all()