From 4b09e990aad62d29bcfd0507d32ab6f10094ac50 Mon Sep 17 00:00:00 2001 From: Artem Date: Tue, 27 Mar 2018 16:29:42 +0200 Subject: [PATCH] Fix #147 (#152) --- lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 55414c6..18b5306 100644 --- a/lib/index.js +++ b/lib/index.js @@ -181,7 +181,7 @@ class Service { if (!params.knex) { this.knexify(countQuery, query); } - return countQuery.then(count => count[0].total).then(executeQuery).catch(errorHandler); + return countQuery.then(count => count[0] ? count[0].total : 0).then(executeQuery).catch(errorHandler); } return executeQuery().catch(errorHandler);