From 2069c8c3d581ed816fe23478708236ec43466db4 Mon Sep 17 00:00:00 2001 From: Thomas Horta Date: Mon, 26 Feb 2024 16:06:46 -0300 Subject: [PATCH] Make sure query is not null in Reader Search --- .../ui/reader/services/search/ReaderSearchJobService.java | 2 +- .../android/ui/reader/services/search/ReaderSearchLogic.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/services/search/ReaderSearchJobService.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/services/search/ReaderSearchJobService.java index ac3de7d727c2..e4f9db580dbb 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/services/search/ReaderSearchJobService.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/services/search/ReaderSearchJobService.java @@ -17,7 +17,7 @@ public class ReaderSearchJobService extends JobService implements ServiceComplet private ReaderSearchLogic mReaderSearchLogic; @Override public boolean onStartJob(JobParameters params) { - if (params.getExtras() != null && params.getExtras().containsKey(ARG_QUERY)) { + if (params.getExtras() != null && params.getExtras().getString(ARG_QUERY) != null) { String query = params.getExtras().getString(ARG_QUERY); int offset = params.getExtras().getInt(ARG_OFFSET, 0); mReaderSearchLogic.startSearch(query, offset, params); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/services/search/ReaderSearchLogic.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/services/search/ReaderSearchLogic.java index f486b330e55d..0002fe3febce 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/services/search/ReaderSearchLogic.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/services/search/ReaderSearchLogic.java @@ -1,5 +1,7 @@ package org.wordpress.android.ui.reader.services.search; +import androidx.annotation.NonNull; + import com.android.volley.VolleyError; import com.wordpress.rest.RestRequest; @@ -24,7 +26,7 @@ public ReaderSearchLogic(ServiceCompletionListener listener) { mCompletionListener = listener; } - public void startSearch(final String query, final int offset, Object companion) { + public void startSearch(@NonNull final String query, final int offset, Object companion) { mListenerCompanion = companion; String path = "read/search?q=" + UrlUtils.urlEncode(query)