Explorar o código

if key is exsit then remove

hanjing %!s(int64=7) %!d(string=hai) anos
pai
achega
aed205e67c
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  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();