Do nothing if ids are empty. More logging.

This commit is contained in:
Amine Bou 2018-03-30 19:54:21 +02:00
parent edb5eabee7
commit 18946464a2

View File

@ -1051,6 +1051,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
Crashlytics.logException(e) Crashlytics.logException(e)
} }
if (ids.isNotEmpty()) {
api.readAll(ids).enqueue(object : Callback<SuccessResponse> { api.readAll(ids).enqueue(object : Callback<SuccessResponse> {
override fun onResponse( override fun onResponse(
call: Call<SuccessResponse>, call: Call<SuccessResponse>,
@ -1072,7 +1073,10 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
if (debugReadingItems) { if (debugReadingItems) {
readAllDebug( readAllDebug(
Throwable("Got response, but : response.body() (${response.body()}) != null && response.body()!!.isSuccess (${response.body()?.isSuccess})") Throwable(
"Got response, but : response.body() (${response.body()}) != null && response.body()!!.isSuccess (${response.body()?.isSuccess})." +
"Request url was (${call.request().url()}), ids were $ids"
)
) )
} }
@ -1094,6 +1098,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
} }
} }
}) })
}
items = ArrayList() items = ArrayList()
if (items.isEmpty()) { if (items.isEmpty()) {
Toast.makeText( Toast.makeText(