From ab49feb1094f3a9afcf0275c6556fd2ad3acf8ed Mon Sep 17 00:00:00 2001 From: Kit Date: Mon, 8 May 2017 14:24:33 +0800 Subject: [PATCH] fixed empty or null response --- firebase-paginator.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/firebase-paginator.js b/firebase-paginator.js index 426a49d..bd7cb52 100644 --- a/firebase-paginator.js +++ b/firebase-paginator.js @@ -181,7 +181,11 @@ function FirebasePaginator(ref, defaults) { if (request.readyState === 4) { var response = JSON.parse(request.responseText); if (request.status === 200) { - resolve(Object.keys(response)); + if (response){ + resolve(Object.keys(response)); + } else { + resolve([]); + } } else { reject(response); }