Skip to content

Commit

Permalink
Null pointer exception in Android
Browse files Browse the repository at this point in the history
  • Loading branch information
Marina González committed Sep 28, 2020
1 parent 9b74abf commit 8754743
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/modules.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,16 @@ class IAPItem {

static List<DiscountIOS> _extractDiscountIOS(dynamic json) {
List list = json as List;
List<DiscountIOS> discounts = list
.map<DiscountIOS>(
(dynamic discount) => DiscountIOS.fromJSON(discount as Map<String, dynamic>),
)
.toList();
List<DiscountIOS> discounts;

if (list != null) {
discounts = list
.map<DiscountIOS>(
(dynamic discount) => DiscountIOS.fromJSON(discount as Map<String, dynamic>),
)
.toList();
}


return discounts;
}
Expand Down

0 comments on commit 8754743

Please sign in to comment.