Преглед изворни кода

if key is exsit then remove

hanjing пре 7 година
родитељ
комит
aed205e67c
1 измењених фајлова са 2 додато и 0 уклоњено
  1. 2 0
      app/src/main/java/com/sheep/gamegroup/util/QQUtil.java

+ 2 - 0
app/src/main/java/com/sheep/gamegroup/util/QQUtil.java

@@ -104,6 +104,7 @@ public class QQUtil {
 
     public static void removeWxPayFrom(Context context, String prepayId) {
         SharedPreferences sp = context.getSharedPreferences("wx_pay_order", Context.MODE_PRIVATE);
+        if (!sp.contains("prepay_" + prepayId)) return;
         SharedPreferences.Editor editor = sp.edit();
         editor.remove("prepay_" + prepayId);
         editor.commit();
@@ -123,6 +124,7 @@ public class QQUtil {
 
     public static void removeWxPayOrderNo(Context context, String prepayId) {
         SharedPreferences sp = context.getSharedPreferences("wx_pay_order", Context.MODE_PRIVATE);
+        if (!sp.contains("orderno_" + prepayId)) return;
         SharedPreferences.Editor editor = sp.edit();
         editor.remove("orderno_" + prepayId);
         editor.commit();