Reagent Restocker

105 - inconsistent database leads to lua exception

What steps will reproduce the problem?
1. I go to my bank
2. I see an error as follows:

Date: 2012-08-31 20:44:41
ID: 1
Error occured in: Global
Count: 1
Message: ..\AddOns\ReagentRestocker\BankBag.lua line 66:
attempt to index field '?' (a nil value)
Debug:
(tail call): ?
ReagentRestocker\BankBag.lua:66: v()
ReagentRestocker\EventHandler.lua:66:
ReagentRestocker\EventHandler.lua:32
(tail call): ?
Locals:
None
AddOns:
...

Debug output is as follows:

Amount in bank: 34 Amount in bags: 20 ID: 62669
Amount in bank: 3 Amount in bags: 20 ID: 62677
Amount in bank: 0 Amount in bags: 0 ID: 46006

Note that it has stopped processing my list of items at this point, so other bank transactions don't seem to occur. The exception stops the loop, I guess, as a result of ID 46006 (Glow Worm, http://www.wowhead.com/item=46006)

Looking in the saved variables file, I see this:

    ["Buy"] = {
        [62669] = 62669,
        [62677] = 62677,
        [46006] = 46006,
        [3371] = 3371,
        [40097] = 40097,
        [53051] = 53051,
        [62671] = 62671,
        [8827] = 8827,
        [58145] = 58145,
        [63388] = 63388,
        [57099] = 57099,
        [5631] = 5631,
    },

If I look at the UI, "Glow Worm" is missing. The item does seem to be in the game still, as I have some on other characters. However, it doesn't appear elsewhere in the saved variables file.

The failing line is just after the debug print:

   dprint("Amount in bank: " .. countBank .. " Amount in bags: " .. countBags .. " ID: " .. k)

   -- Get how many we want

desired = ReagentRestockerDB.Items[k].qty

I guess what this means is that the .Items array doesn't contain an element for ID=46006. Seems as if the two parts of the database have got out of sync with each other.

I don't know how that would have happened, but it would be nice if the mod corrected for this kind of thing, for example by cleaning buy and sell IDs that didn't exist in the .Items array on startup.

I fixed this by editing the "[46006] = 46006," line out of the saved variables. I then got hit with the same issue on 63388 (Dust of Disappearance) which I actually had some of in my bags. Removing the corresponding line for that second item did make everything work, and all my bank transactions do now appear to be happening.

User When Change
CobraA1 Oct 08, 2012 at 13:33 UTC
CobraA1 Sep 03, 2012 at 11:25 UTC
alerre Aug 31, 2012 at 20:06 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

  • 2 comments
  • Avatar of CobraA1 CobraA1 Oct 08, 2012 at 13:33 UTC - 0 likes

    Database consistency check added in 4.0. If you can figure out how to reproduce the bug, feel free to file another bug report.

  • Avatar of CobraA1 CobraA1 Oct 08, 2012 at 12:43 UTC - 0 likes

    "However, it doesn't appear elsewhere in the saved variables file."

    This is bad, as it's supposed to be in the "Items" list as well.

    The only way to really resolve this is to implement a database check :(.

    Ideally, this should never happen. And it's gonna be tough to figure out why it does :(.

  • 2 comments

Facts

Last updated
Oct 08, 2012
Reported
Aug 31, 2012
Status
Fixed - Developer made requested changes. QA should verify.
Type
Defect - A shortcoming, fault, or imperfection
Priority
Medium - Normal priority.
Votes
0

Reported by

Possible assignees