@@ -19,7 +19,7 @@ local AccountStoreBaseCardEvents = {
19
19
20
20
function AccountStoreBaseCardMixin :OnLoad ()
21
21
self .BuyButton :SetScript (" OnEnter" , function ()
22
- if not self .BuyButton :IsEnabled () then
22
+ if not self .BuyButton :IsEnabled () and self . itemInfo then
23
23
AccountStoreUtil .ShowDisabledItemInfoTooltip (self .BuyButton , self .itemInfo );
24
24
end
25
25
end );
@@ -58,12 +58,16 @@ function AccountStoreBaseCardMixin:OnHide()
58
58
end
59
59
60
60
function AccountStoreBaseCardMixin :OnEnter ()
61
+ local itemInfo = self .itemInfo ;
62
+ if not itemInfo then
63
+ return ;
64
+ end
65
+
61
66
if not self .hoverSoundPlayed then
62
67
self .hoverSoundPlayed = true ;
63
68
PlaySound (SOUNDKIT .ACCOUNT_STORE_ITEM_HOVER );
64
69
end
65
70
66
- local itemInfo = self .itemInfo ;
67
71
local description = itemInfo .description ;
68
72
if not description then
69
73
return ;
@@ -110,7 +114,7 @@ function AccountStoreBaseCardMixin:OnEvent(event, ...)
110
114
self :UpdateCardDisplay ();
111
115
elseif event == " ACCOUNT_STORE_ITEM_INFO_UPDATED" then
112
116
local itemID = ... ;
113
- if itemID == self .itemInfo . id then
117
+ if itemID == self .itemID then
114
118
self :SetItemID (itemID );
115
119
end
116
120
end
@@ -161,9 +165,13 @@ function AccountStoreBaseCardMixin:SetItemID(itemID)
161
165
end
162
166
163
167
function AccountStoreBaseCardMixin :SelectCard ()
168
+ local itemInfo = self .itemInfo ;
169
+ if not itemInfo then
170
+ return ;
171
+ end
172
+
164
173
PlaySound (SOUNDKIT .ACCOUNT_STORE_ITEM_SELECT );
165
174
166
- local itemInfo = self .itemInfo ;
167
175
local isRefundable = itemInfo .status == Enum .AccountStoreItemStatus .Refundable ;
168
176
local confirmationFormat = isRefundable and ACCOUNT_STORE_REFUND_CONFIRMATION_FORMAT or PLUNDERSTORE_PURCHASE_CONFIRMATION_FORMAT ;
169
177
local confirmation = confirmationFormat :format (itemInfo .name , AccountStoreUtil .FormatCurrencyDisplay (itemInfo .price , itemInfo .currencyID ));
@@ -193,7 +201,7 @@ function AccountStoreBaseCardMixin:CheckForItemStateUpdate()
193
201
194
202
refreshedItemInfo .status = Enum .AccountStoreItemStatus .Refundable ;
195
203
196
- if refreshedItemInfo .status ~= self .itemInfo .status then
204
+ if not self . itemInfo or ( refreshedItemInfo .status ~= self .itemInfo .status ) then
197
205
self :SetItemID (self .itemID );
198
206
elseif refreshedItemInfo .refundSecondsRemaining ~= self .itemInfo .refundSecondsRemaining then
199
207
self .itemInfo .refundSecondsRemaining = refreshedItemInfo .refundSecondsRemaining ;
203
211
204
212
function AccountStoreBaseCardMixin :UpdateRefundTime ()
205
213
local itemInfo = self .itemInfo ;
214
+ if not itemInfo then
215
+ return ;
216
+ end
217
+
206
218
local refundable = (itemInfo .status == Enum .AccountStoreItemStatus .Refundable ) and itemInfo .refundSecondsRemaining ;
207
219
self .RefundText :SetShown (refundable );
208
220
self :SetScript (" OnUpdate" , refundable and self .OnUpdate or nil );
0 commit comments