Skip to content

Commit

Permalink
fix: NPE in ProductListAdapter (#4469)
Browse files Browse the repository at this point in the history
  • Loading branch information
R4md4c committed Feb 8, 2022
1 parent 70d4e09 commit 3af2973
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ProductListAdapter(
holder.tvDetails.text = products[position].productDetails
holder.tvBarcode.text = products[position].barcode

if (!isLowBatteryMode && products[position].imageUrl.isNotEmpty()) {
if (!isLowBatteryMode && !products[position].imageUrl.isNullOrEmpty()) {
picasso
.load(products[position].imageUrl)
.placeholder(R.drawable.placeholder_thumb)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import org.greenrobot.greendao.annotation.Index;
import org.greenrobot.greendao.annotation.Property;

import javax.annotation.Nullable;

@Entity(
nameInDb = "YOUR_LISTED_PRODUCT",
indexes = {@Index(value = "listId, barcode", unique = true)}
Expand Down Expand Up @@ -82,6 +84,7 @@ public void setProductDetails(String productDetails) {
this.productDetails = productDetails;
}

@Nullable
public String getImageUrl() {
return this.imageUrl;
}
Expand Down

0 comments on commit 3af2973

Please sign in to comment.