Skip to content

Commit e04fc7c

Browse files
authored
Merge pull request #9857 from wordpress-mobile/fix_crash_in_giphy_picker
Treat response.pagination field as nullable
2 parents 33cbe73 + b568afa commit e04fc7c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

WordPress/src/main/java/org/wordpress/android/viewmodel/giphy/GiphyPickerDataSource.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ class GiphyPickerDataSource(
7777

7878
apiClient.search(searchQuery, gif, params.requestedLoadSize, startPosition, null, null) { response, error ->
7979
if (response != null) {
80-
callback.onResult(response.data.toGiphyMediaViewModels(), startPosition, response.pagination.totalCount)
80+
callback.onResult(
81+
response.data.toGiphyMediaViewModels(),
82+
startPosition,
83+
response.pagination?.totalCount ?: response.data.size
84+
)
8185
} else {
8286
initialLoadError = error
8387
callback.onResult(emptyList(), startPosition, 0)

0 commit comments

Comments
 (0)