Skip to content

Commit

Permalink
Merge pull request #43 from Sencerd/master
Browse files Browse the repository at this point in the history
Fix code attempting to set an enum to null in Card.cs
  • Loading branch information
Bucimis authored Oct 2, 2018
2 parents ab1d6bb + 5cdc490 commit bb307f0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Assets/Plugins/Appboy/models/Cards/Card.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,14 @@ public Card(JSONClass json) {
Categories.Add(CardCategory.NO_CATEGORY);
} else {
for (int i = 0; i < jsonArray.Count; i++) {
CardCategory category = (CardCategory)EnumUtils.TryParse(typeof(CardCategory), jsonArray[i], true, null);
if (category != null) {
CardCategory category = (CardCategory)EnumUtils.TryParse(typeof(CardCategory), jsonArray[i], true, CardCategory.NO_CATEGORY);
if (category != CardCategory.NO_CATEGORY) {
Categories.Add(category);
}
}
if (Categories.Count == 0) {
Categories.Add(CardCategory.NO_CATEGORY);
}
}
}

Expand Down

0 comments on commit bb307f0

Please sign in to comment.