ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   bug in mailinbox_keyboard (https://www.esoui.com/forums/showthread.php?t=6360)

sirinsidiator 06/16/16 01:53 PM

bug in mailinbox_keyboard
 
I got the following error when I opened the mailbox after deleting a mail at the same time that I got removed from a dungeon instance:
Code:

EsoUI/Ingame/Mail/Keyboard/MailInbox_Keyboard.lua:440: attempt to index a nil value
stack traceback:
        EsoUI/Ingame/Mail/Keyboard/MailInbox_Keyboard.lua:440: in function 'MailInbox:RefreshMailFrom'
        EsoUI/Ingame/Mail/Keyboard/MailInbox_Keyboard.lua:398: in function 'MailInbox:OnInboxUpdate'
        EsoUI/Ingame/Mail/Keyboard/MailInbox_Keyboard.lua:54: in function '(anonymous)'

GetMailData can return a nil value, but most instances where it is used do not protect against it. It's a minor bug that probably doesn't occur often, but it also doesn't require much to fix it. ;)

Lodur 06/18/16 01:01 PM

Yes, I see this a lot too with my MailLooter addon. This was not an issue in previous ESO releases for a while... It was an issue before way over a year or two ago now.... It just started again with the DarkBrotherhood release.

I can reproduce it pretty easy with MailLooter. Just have only hireling mail in your inbox. Go to MailLooter and loot all hireling mail. Go back to the Inbox and Lua error...

Code:

EsoUI/Ingame/Mail/MailInbox_Shared.lua:51: attempt to index a nil value
stack traceback:
        EsoUI/Ingame/Mail/MailInbox_Shared.lua:51: in function 'ZO_MailInboxShared_PopulateMailData'
        EsoUI/Ingame/Mail/Keyboard/MailInbox_Keyboard.lua:425: in function 'MailInbox:OnMailReadable'
        EsoUI/Ingame/Mail/Keyboard/MailInbox_Keyboard.lua:49: in function 'callback'
        EsoUI/Libraries/Utility/ZO_CallbackObject.lua:111: in function 'ZO_CallbackObject:FireCallbacks'
        EsoUI/Libraries/ZO_Scene/ZO_Scene.lua:248: in function 'ZO_Scene:SetState'
        EsoUI/Libraries/ZO_Scene/ZO_Scene.lua:363: in function 'ZO_Scene:DetermineIfTransitionIsComplete'
        EsoUI/Libraries/ZO_Scene/ZO_Scene.lua:306: in function 'ZO_Scene:OnSceneFragmentStateChange'
        EsoUI/Libraries/ZO_Scene/ZO_SceneFragment.lua:108: in function 'ZO_SceneFragment:SetState'
        EsoUI/Libraries/ZO_Scene/ZO_SceneFragment.lua:114: in function 'ZO_SceneFragment:OnShown'
        EsoUI/Libraries/ZO_Scene/ZO_SceneFragmentTemplates.lua:57: in function '(anonymous)'

Deleting the last mail in the inbox from out code outside the inbox is the sure way to get this. But it happens other times as well. I think when the last select mail in the InBox is delete out from under the inbox.

Lodur 06/18/16 01:43 PM

The problem may be that in:

https://github.com/esoui/esoui/blob/...x_keyboard.lua
Code:

function MailInbox:OnMailRemoved(mailId)
    self.reportedMailIds[zo_getSafeId64Key(mailId)] = nil
    self:RefreshData()
end

Needs to be:

Code:

function MailInbox:OnMailRemoved(mailId)
    if mailId == self.dirtyMail then
        self.dirtyMail = nil
    end

    self.reportedMailIds[zo_getSafeId64Key(mailId)] = nil
    self:RefreshData()
end


The crash in my post above is from MailInbox trying to load the mail info from a mailId (self.dirtyMail) for a mail that is now deleted.

Lodur 06/18/16 02:15 PM

Actually make that:

Code:

function MailInbox:OnMailRemoved(mailId)
    if self.control:IsHidden() then
        if AreId64sEqual(mailId, self.dirtyMail) then
            self.dirtyMail = nil
        end

        if AreId64sEqual(mailId, self.mailId) then
            self.mailId = nil
        end
    end

    self.reportedMailIds[zo_getSafeId64Key(mailId)] = nil
    self:RefreshData()
end


Lodur 06/18/16 02:33 PM

The MailLooter addon in version 1.1.1 is patching the above code into the MailInbox. If it causes anyone a problem please let me know.

merlight 06/18/16 03:36 PM

You should be using AreId64sEqual to compare mailId

Lodur 06/18/16 10:07 PM

Quote:

Originally Posted by merlight (Post 27486)
You should be using AreId64sEqual to compare mailId

Thanks. Should have remembered that since the rest of my Addon does that....


All times are GMT -6. The time now is 03:58 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI