Fix possible crash

I don't think this should ever happen, unless someone manually edited
their import or DB, but this crash was logged in Google Play Console
anyway so...
This commit is contained in:
Sylvia van Os
2021-09-20 22:58:37 +02:00
parent 2e648d1062
commit 616ca77c39

View File

@@ -72,6 +72,12 @@ public class CatimaBarcode {
}
public String prettyName() {
return barcodePrettyNames.get(barcodeFormats.indexOf(mBarcodeFormat));
int index = barcodeFormats.indexOf(mBarcodeFormat);
if (index == -1 || index >= barcodePrettyNames.size()) {
return mBarcodeFormat.name();
}
return barcodePrettyNames.get(index);
}
}