From b568afac063bd61d4dc439c2329281a3d12b4883 Mon Sep 17 00:00:00 2001 From: vojtasmrcek Date: Tue, 14 May 2019 14:47:15 +0200 Subject: [PATCH] Treat response.pagination field as nullable --- .../android/viewmodel/giphy/GiphyPickerDataSource.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/WordPress/src/main/java/org/wordpress/android/viewmodel/giphy/GiphyPickerDataSource.kt b/WordPress/src/main/java/org/wordpress/android/viewmodel/giphy/GiphyPickerDataSource.kt index 9c4f87cce7e1..90903a50dd58 100644 --- a/WordPress/src/main/java/org/wordpress/android/viewmodel/giphy/GiphyPickerDataSource.kt +++ b/WordPress/src/main/java/org/wordpress/android/viewmodel/giphy/GiphyPickerDataSource.kt @@ -77,7 +77,11 @@ class GiphyPickerDataSource( apiClient.search(searchQuery, gif, params.requestedLoadSize, startPosition, null, null) { response, error -> if (response != null) { - callback.onResult(response.data.toGiphyMediaViewModels(), startPosition, response.pagination.totalCount) + callback.onResult( + response.data.toGiphyMediaViewModels(), + startPosition, + response.pagination?.totalCount ?: response.data.size + ) } else { initialLoadError = error callback.onResult(emptyList(), startPosition, 0)