diff --git a/Runtime/GuruIAP/Runtime/Code/IAPServiceBase.cs b/Runtime/GuruIAP/Runtime/Code/IAPServiceBase.cs index 07f359e..91aa81c 100644 --- a/Runtime/GuruIAP/Runtime/Code/IAPServiceBase.cs +++ b/Runtime/GuruIAP/Runtime/Code/IAPServiceBase.cs @@ -35,7 +35,7 @@ namespace Guru private Dictionary _products; protected Dictionary Products => _products; - public bool IsInitialized => _storeController != null && _storeExtensionProvider != null; + public bool IsInitialized => _storeController != null && _storeExtensionProvider != null && _model != null; private ProductInfo _curProductInfo = null; private string _curProductCategory = ""; @@ -881,7 +881,10 @@ namespace Guru /// public static void SetIsIAPUser(bool value = true) { - Instance._model.SetIsIapUser(value); // 用户属性 + if (Instance != null && Instance._model != null) + { + Instance._model.SetIsIapUser(value); // 用户属性 + } Analytics.SetUserProperty(Analytics.PropertyIsIAPUser, value ? "true" : "false"); }