diff --git a/app/src/main/java/protect/card_locker/importexport/StocardImporter.java b/app/src/main/java/protect/card_locker/importexport/StocardImporter.java index a1507df96..74ccc1c5a 100644 --- a/app/src/main/java/protect/card_locker/importexport/StocardImporter.java +++ b/app/src/main/java/protect/card_locker/importexport/StocardImporter.java @@ -3,6 +3,7 @@ package protect.card_locker.importexport; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.graphics.Bitmap; +import android.util.Log; import com.google.zxing.BarcodeFormat; @@ -39,6 +40,8 @@ import protect.card_locker.ZipUtils; * A header is expected for the each table showing the names of the columns. */ public class StocardImporter implements Importer { + private static final String TAG = "Catima"; + public void importData(Context context, SQLiteDatabase database, InputStream input, char[] password) throws IOException, FormatException, JSONException, ParseException { HashMap> loyaltyCardHashMap = new HashMap<>(); HashMap> providers = new HashMap<>(); @@ -201,6 +204,12 @@ public class StocardImporter implements Importer { for (HashMap loyaltyCardData : loyaltyCardHashMap.values()) { String providerId = (String) loyaltyCardData.get("_providerId"); + + if (providerId == null) { + Log.d(TAG, "Missing providerId for card " + loyaltyCardData + ", ignoring..."); + continue; + } + HashMap providerData = providers.get(providerId); String store = providerData != null ? providerData.get("name").toString() : providerId;