Przeglądaj źródła

修复空指针异常

hy 3 lat temu
rodzic
commit
242ef02c11

+ 15 - 14
app/src/main/java/com/electric/chargingpile/activity/ConfirmOrderActivity.java

@ -410,23 +410,24 @@ public class ConfirmOrderActivity extends AppCompatActivity implements View.OnCl
410 410
    }
411 411
412 412
    private void removeData(List<RedEnvelopeBean> datas) {
413
        String userMoney = mChargingBean.getUserMoney();
414
        if (TextUtils.isEmpty(userMoney)){
415
            return;
416
        }
417
        try {
418
            for (int i = datas.size() - 1; i >= 0; i--) {
419
                RedEnvelopeBean redEnvelopeBean = datas.get(i);
420
                double max_money = Double.parseDouble(redEnvelopeBean.getMax_money());
421
                double money = Double.parseDouble(userMoney);
422
                if (money < max_money) {
423
                    datas.remove(i);
413
        if (mChargingBean!=null){
414
            String userMoney = mChargingBean.getUserMoney();
415
            if (TextUtils.isEmpty(userMoney)){
416
                return;
417
            }
418
            try {
419
                for (int i = datas.size() - 1; i >= 0; i--) {
420
                    RedEnvelopeBean redEnvelopeBean = datas.get(i);
421
                    double max_money = Double.parseDouble(redEnvelopeBean.getMax_money());
422
                    double money = Double.parseDouble(userMoney);
423
                    if (money < max_money) {
424
                        datas.remove(i);
425
                    }
424 426
                }
427
            } catch (NumberFormatException e) {
428
                LogUtils.e("polling=" + e.getMessage());
425 429
            }
426
        } catch (NumberFormatException e) {
427
            LogUtils.e("polling=" + e.getMessage());
428 430
        }
429
430 431
    }
431 432
432 433
    @Override