Skip to content

Commit

Permalink
fix: NPE on user search
Browse files Browse the repository at this point in the history
Closes #3941
  • Loading branch information
VaiTon committed Apr 18, 2021
1 parent 8e59ada commit bbdb6a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Expand Up @@ -15,7 +15,6 @@
*/
package openfoodfacts.github.scrachx.openfood.features.scan

import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.hardware.Camera
Expand Down Expand Up @@ -206,7 +205,7 @@ class ContinuousScanActivity : BaseActivity() {
}

// Then query the online db
productDisp = client.getProductStateFull(barcode, Utils.HEADER_USER_AGENT_SCAN)
productDisp = client.getProductStateFull(barcode, userAgent = Utils.HEADER_USER_AGENT_SCAN)
.observeOn(AndroidSchedulers.mainThread())
.doOnSubscribe {
hideAllViews()
Expand Down
Expand Up @@ -58,11 +58,11 @@ class OpenFoodAPIClient @Inject constructor(

fun getProductStateFull(
barcode: String,
customFields: String = getAllFields(),
customHeader: String = Utils.HEADER_USER_AGENT_SEARCH
fields: String = getAllFields(),
userAgent: String = Utils.HEADER_USER_AGENT_SEARCH
): Single<ProductState> {
sentryAnalytics.setBarcode(barcode)
return rawApi.getProductByBarcode(barcode, customFields, localeManager.getLanguage(), getUserAgent(customHeader))
return rawApi.getProductByBarcode(barcode, fields, localeManager.getLanguage(), getUserAgent(userAgent))
}

fun getProductsByBarcode(
Expand Down

0 comments on commit bbdb6a3

Please sign in to comment.