Przeglądaj źródła

if key is exsit then remove

hanjing 7 lat temu
rodzic
commit
aed205e67c

+ 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();