Commit c0f423a0372b8dadca7fa2aa35b259be8d8a2679

Authored by zhangqijia
1 parent 590d9c55

fix: 判空防止崩溃

Showing 1 changed file with 2 additions and 2 deletions   Show diff stats
src/models/Store.lua
@@ -501,12 +501,12 @@ function Store:onBuyCard(type, duration, id, actid) @@ -501,12 +501,12 @@ function Store:onBuyCard(type, duration, id, actid)
501 return {} 501 return {}
502 elseif type == CardType.ActBattleCommandCard then 502 elseif type == CardType.ActBattleCommandCard then
503 if not self.owner.activity:isOpenById(actid, "ActShopGoods") then 503 if not self.owner.activity:isOpenById(actid, "ActShopGoods") then
504 - skynet.error("not open, actid: " .. actid .. "; id: " .. id) 504 + skynet.error("not open, actid: " .. (actid or 0) .. "; id: " .. (id or 0))
505 return nil 505 return nil
506 end 506 end
507 local actCfg = csvdb["activity_ctrlCsv"][actid] 507 local actCfg = csvdb["activity_ctrlCsv"][actid]
508 if not actCfg then 508 if not actCfg then
509 - skynet.error("actCfg is nil, actid: " .. actid .. "; id: " .. id) 509 + skynet.error("actCfg is nil, actid: " .. (actid or 0) .. "; id: " .. (id or 0))
510 return nil 510 return nil
511 end 511 end
512 local actData = self.owner.activity:getActData("BattleCommand") or {} 512 local actData = self.owner.activity:getActData("BattleCommand") or {}