View Single Post
07/26/18, 08:22 AM   #1
SDPhantom
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 47
[outdated] GetNewSavedVars() mishandled optional namespace argument

Code:
ZO_SavedVars:New("TestSV",1,{},"TestProfile");
Running this despite an attempt to handle namespace as an optional argument causes an error in trying to access "TestProfile" as the defaults table instead of a string. This is caused by GetNewSavedVars() checking the wrong argument being nil.



EsoUI\Libraries\Utility\ZO_SavedVars.lua:143
Code:
if defaults == nil and type(namespace) == "table" then
defaults should at least be changed to profile since in this case, that's the argument that's nil.
Code:
if profile == nil and type(namespace) == "table" then


Preferably, there shouldn't be a check for nil there anyway since the following code block handles rearranging the arguments into the correct places. Stopping this from happening causes this error in the first place. The down side to removing this check? You ignore a value that should be discarded anyway.