Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lib:GetPlayerAddress issue #4

Closed
dethanyel opened this issue Jul 22, 2016 · 0 comments
Closed

Lib:GetPlayerAddress issue #4

dethanyel opened this issue Jul 22, 2016 · 0 comments

Comments

@dethanyel
Copy link

In the function Lib:GetPlayerAddress(address), the capture pattern used to retrieve the realm name from the address string, (%S+), does not seem to return the full realm name if the realm contains a whitespace.

This will cause issues for players on Connected Realms featuring realms that have whitespaces in their names (e.g., Kirin Tor and Steamwheedle Cartel). For example, when logged into a character on Kirin Tor, mousing over the money frame in Bagnon will generate a lua error if there is cached data for characters on Steamwheedle Cartel. The calls made to Lib:GetPlayerAddress return just "Steamwheedle", resulting in a lua error when BrotherBags[realm][player].money is referenced later on.

A simple fix is to use (.+) for the realm capture instead of (%S+):
local player, realm = strmatch(address or '', '(%S+) %- (.+)')

Also, below is the original error I got when mousing over the money frame:

Message: ...s\Bagnon\libs\LibItemCache-1.1\Caches\BagBrother.lua:112: attempt to index field '?' (a nil value)
Time: 07/22/16 13:56:12
Count: 1
Stack: [C]: ?
...s\Bagnon\libs\LibItemCache-1.1\Caches\BagBrother.lua:112: in function <...s\Bagnon\libs\LibItemCache-1.1\Caches\BagBrother.lua:111>
(tail call): ?
...terface\AddOns\Bagnon\libs\LibItemCache-1.1\Core.lua:57: in function `GetPlayerMoney'
Interface\AddOns\Bagnon\components\moneyFrame.lua:63: in function `OnEnter'
Interface\AddOns\Bagnon\components\moneyFrame.lua:23: in function <Interface\AddOns\Bagnon\components\moneyFrame.lua:23>

Locals: 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant