Don't crash if color is still not valid

This commit is contained in:
Sylvia van Os
2019-12-11 17:19:16 +01:00
parent 896da82b13
commit 09727038ce

View File

@@ -119,7 +119,11 @@ public class PkpassImporter {
{
// Maybe they violate the spec, let's parse it in a format Android understands
// Necessary for at least Eurowings
headerColor = Color.parseColor(json.getString("backgroundColor"));
try
{
headerColor = Color.parseColor(json.getString("backgroundColor"));
}
catch (IllegalArgumentException ex) {}
}
@@ -137,7 +141,11 @@ public class PkpassImporter {
{
// Maybe they violate the spec, let's parse it in a format Android understands
// Necessary for at least Eurowings
headerTextColor = Color.parseColor(json.getString("labelColor"));
try
{
headerTextColor = Color.parseColor(json.getString("labelColor"));
}
catch (IllegalArgumentException ex) {}
}
return new LoyaltyCard(-1, store, note, cardId, barcodeType, headerColor, headerTextColor);