mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-10-22 14:04:54 -04:00
Bail if loyalty card could not be found
This case was hit at least once by a user, though the scenario is not known. If it is hit, post a message and bail gracefully, until the reason can be determined.
This commit is contained in:
1 parent
15425d51aa
commit
4143e5c286
9 files changed
+36
-1
No files matched your search
@@ -25,6 +25,7 @@ import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.zxing.BarcodeFormat;
|
||||
import com.google.zxing.integration.android.IntentIntegrator;
|
||||
@@ -125,6 +126,13 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
|
||||
if(updateLoyaltyCard || viewLoyaltyCard)
|
||||
{
|
||||
final LoyaltyCard loyaltyCard = db.getLoyaltyCard(loyaltyCardId);
|
||||
if(loyaltyCard == null)
|
||||
{
|
||||
Log.w(TAG, "Could not lookup loyalty card " + loyaltyCardId);
|
||||
Toast.makeText(this, R.string.noCardExistsError, Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
if(storeFieldEdit.getText().length() == 0)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user