Scrap (Junk Seller)

Scrap (Junk Seller)

21M Downloads

Lua error if you vendor with Scrap immediately upon login

KyrosKrane opened this issue ยท 0 comments

commented

Running Software (issues missing this information will be deleted):

  • Addon version: 10.1.1
  • Server patch: 10.1.5.50585

Have you read the changelog? (please don't waste our time)
Yes

Describe the bug
If you log in, immediately open a vendor, and try to sell an item using Scrap, a lua error occurs. The error is because the game itself has not yet initialized the information for all the items in the bags, so it returns an unexpected nil value.

To Reproduce
Steps to reproduce the behaviour:

  1. Have an item that Scrap is set to auto-vendor in your bags. It can be a gray item, or an item that you've manually marked as junk.
  2. Log out in click range of a vendor.
  3. Log in.
  4. Immediately upon getting control, right click the vendor to open the screen. Scrap will attempt to auto sell the item.
  5. The error occus.

Expected behaviour
The error does not happen. Scrap does not sell the item (it doesn't have the information needed to know whether to sell it yet). A later press of the Sell Junk button, or closing and reopening the vendor window at a later time, does allow the item to be sold. Optionally, give the user an error message to try again later.

Error Logs

2x Scrap/addons/merchant/button.lua:225: table index is nil
[string "@Scrap/addons/merchant/button.lua"]:225: in function `GetReport'
[string "@Scrap/addons/merchant/button.lua"]:187: in function `Sell'
[string "@Scrap/addons/merchant/button.lua"]:51: in function `?'
[string "@AllTheThings/lib/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:109: in function <...ings/lib/CallbackHandler-1.0/CallbackHandler-1.0.lua:109>
[string "=[C]"]: ?
[string "@AllTheThings/lib/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:19: in function <...ings/lib/CallbackHandler-1.0/CallbackHandler-1.0.lua:15>
[string "@AllTheThings/lib/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:54: in function `SendMessage'
[string "@BagBrother/libs/WildAddon-1.0-1/WildAddon-1.0.lua"]:83: in function `SendSignal'
[string "@Scrap/addons/main/main.lua"]:35: in function <Scrap/addons/main/main.lua:35>
[string "=[C]"]: ?
[string "@AllTheThings/lib/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:19: in function <...ings/lib/CallbackHandler-1.0/CallbackHandler-1.0.lua:15>
[string "@AllTheThings/lib/CallbackHandler-1.0-8/CallbackHandler-1.0.lua"]:54: in function `Fire'
[string "@BagBrother/libs/AceEvent-3.0-4/AceEvent-3.0.lua"]:120: in function <BagBrother/libs/AceEvent-3.0/AceEvent-3.0.lua:119>

Locals:
self = Button {
 SendSignal = <function> defined @BagBrother/libs/WildAddon-1.0/WildAddon-1.0.lua:82
 OnLeave = <function> defined @Scrap/addons/merchant/button.lua:125
 NewModule = <function> defined @BagBrother/libs/WildAddon-1.0/WildAddon-1.0.lua:68
 OnReceiveDrag = <function> defined @Scrap/addons/merchant/button.lua:112
 OnClick = <function> defined @Scrap/addons/merchant/button.lua:84
 UpdateState = <function> defined @Scrap/addons/merchant/button.lua:134
 OnMerchant = <function> defined @Scrap/addons/merchant/button.lua:49
 UpdatePosition = <function> defined @Scrap/addons/merchant/button.lua:160
 OnClose = <function> defined @Scrap/addons/merchant/button.lua:76
 Sell = <function> defined @Scrap/addons/merchant/button.lua:186
 Delay = <function> defined @BagBrother/libs/MutexDelay-1.0/MutexDelay-1.0.lua:27
 Tag = "SCRAP_"
 OnBagUpdate = <function> defined @Scrap/addons/merchant/button.lua:68
 AnyJunk = <function> defined @Scrap/addons/merchant/button.lua:233
 RegisterMessage = <function> defined @AllTheThings/lib/CallbackHandler-1.0/CallbackHandler-1.0.lua:80
 UnregisterMessage = <function> defined @AllTheThings/lib/CallbackHandler-1.0/CallbackHandler-1.0.lua:143
 border = Texture {
 }
 GetReport = <function> defined @Scrap/addons/merchant/button.lua:218
 UpdateTip = <function> defined @Scrap/addons/merchant/button.lua:140
 SendMessage = <function> defined @AllTheThings/lib/CallbackHandler-1.0/CallbackHandler-1.0.lua:49
 CanGuildRepair = <function> defined @Scrap/addons/merchant/button.lua:248
 UnregisterSignal = <function> defined @BagBrother/libs/WildAddon-1.0/WildAddon-1.0.lua:78
 RegisterEvent = <function> defined @AllTheThings/lib/CallbackHandler-1.0/CallbackHandler-1.0.lua:80
 UnregisterAllMessages = <function> defined @AllTheThings/lib/CallbackHandler-1.0/CallbackHandler-1.0.lua:164
 icon = Texture {
 }
 0 = <userdata>
 OnEnable = <function> defined @Scrap/addons/merchant/button.lua:13
 OnEnter = <function> defined @Scrap/addons/merchant/button.lua:120
 Repair = <function> defined @Scrap/addons/merchant/button.lua:237
 UnregisterAllEvents = <function> defined @AllTheThings/lib/CallbackHandler-1.0/CallbackHandler-1.0.lua:164
 Delaying = <function> defined @BagBrother/libs/MutexDelay-1.0/MutexDelay-1.0.lua:46
 UnregisterEvent = <function> defined @AllTheThings/lib/CallbackHandler-1.0/CallbackHandler-1.0.lua:143
 RegisterSignal = <function> defined @BagBrother/libs/WildAddon-1.0/WildAddon-1.0.lua:74
}
qualities = <table> {
}
total = 0
(for generator) = <function> defined @Scrap/addons/main/main.lua:80
(for state) = nil
(for control) = 0
bag = 0
slot = 17
item = <table> {
 itemName = ""
 hasLoot = false
 hyperlink = "|cffffffff|Hitem:33452::::::::70:259:::::::::|h[]|h|r"
 iconFileID = 133963
 hasNoValue = false
 isLocked = false
 itemID = 33452
 isBound = false
 stackCount = 3
 isFiltered = false
 isReadable = false
}
(*temporary) = nil
(*temporary) = 3
(*temporary) = 3
(*temporary) = <table> {
 itemName = ""
 hasLoot = false
 hyperlink = "|cffffffff|Hitem:33452::::::::70:259:::::::::|h[]|h|r"
 iconFileID = 133963
 hasNoValue = false
 isLocked = false
 itemID = 33452
 isBound = false
 stackCount = 3
 isFiltered = false
 isReadable = false
}
(*temporary) = ""
(*temporary) = "table index is nil"
C = <table> {
 GetContainerItemCooldown = <function> defined =[C]:-1
 hooksecurefunc = <function> defined @BagBrother/libs/C_Everywhere/C_Everywhere.lua:37
 rawfind = <function> defined @BagBrother/libs/C_Everywhere/C_Everywhere.lua:35
 GetContainerItemPurchaseInfo = <function> defined @