Showing
2 changed files
with
6 additions
and
4 deletions
... | @@ -653,7 +653,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -653,7 +653,8 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
653 | 653 | ||
654 | String tempCoupon = ""; | 654 | String tempCoupon = ""; |
655 | int result = 0; | 655 | int result = 0; |
656 | - if (mCoupon.getCoupon().length() == 13) { | 656 | + if (mCoupon != null) { |
657 | + if (!TextUtils.isEmpty(mCoupon.getCoupon()) && mCoupon.getCoupon().length() == 13) { | ||
657 | tempCoupon = mCoupon.getCoupon(); | 658 | tempCoupon = mCoupon.getCoupon(); |
658 | 659 | ||
659 | try { | 660 | try { |
... | @@ -663,7 +664,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -663,7 +664,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
663 | } catch (Exception e) { | 664 | } catch (Exception e) { |
664 | e.printStackTrace(); | 665 | e.printStackTrace(); |
665 | } | 666 | } |
666 | - } else { | 667 | + } else if (!TextUtils.isEmpty(mCoupon.getCoupon()) && mCoupon.getCoupon().length() != 13) { |
667 | try { | 668 | try { |
668 | tempCoupon = mCoupon.getCoupon(); | 669 | tempCoupon = mCoupon.getCoupon(); |
669 | for (int i = 0; i < (12 - mCoupon.getCoupon().length()); i++) { | 670 | for (int i = 0; i < (12 - mCoupon.getCoupon().length()); i++) { |
... | @@ -683,6 +684,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -683,6 +684,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
683 | e.printStackTrace(); | 684 | e.printStackTrace(); |
684 | } | 685 | } |
685 | } | 686 | } |
687 | + } | ||
686 | 688 | ||
687 | createBarcodeBitmap(tempCoupon); | 689 | createBarcodeBitmap(tempCoupon); |
688 | } | 690 | } | ... | ... |
... | @@ -160,7 +160,7 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -160,7 +160,7 @@ public class Coupon implements Parcelable, Serializable { |
160 | if (json != null) { | 160 | if (json != null) { |
161 | this.barcode = json.optString(BARCODE); | 161 | this.barcode = json.optString(BARCODE); |
162 | this.category = json.optString(CATEGORY); | 162 | this.category = json.optString(CATEGORY); |
163 | - this.coupon = json.optString(COUPON); | 163 | + this.coupon = json.optString(COUPON, ""); |
164 | this.created = json.optString(CREATED); | 164 | this.created = json.optString(CREATED); |
165 | this.description = json.optString(DESCRIPTION); | 165 | this.description = json.optString(DESCRIPTION); |
166 | this.discount = json.optString(DISCOUNT); | 166 | this.discount = json.optString(DISCOUNT); |
... | @@ -214,7 +214,7 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -214,7 +214,7 @@ public class Coupon implements Parcelable, Serializable { |
214 | e.printStackTrace(); | 214 | e.printStackTrace(); |
215 | } | 215 | } |
216 | } | 216 | } |
217 | - this.coupon = json.optString(COUPON); | 217 | + this.coupon = json.optString(COUPON, ""); |
218 | this.couponsetUuid = json.optString(COUPONSET_UUID); | 218 | this.couponsetUuid = json.optString(COUPONSET_UUID); |
219 | this.discount = json.optString(DISCOUNT); | 219 | this.discount = json.optString(DISCOUNT); |
220 | if (this.discount.contains(",")) { | 220 | if (this.discount.contains(",")) { | ... | ... |
-
Please register or login to post a comment