Auctionator

Auctionator

141M Downloads

In selling settings, creating a new filter and leaving item name blank returns error - raw fix included (tested in game)

ceylina opened this issue ยท 1 comments

commented

4.0.8

Should it not default to a warning if this field need to be populated?

1x Auctionator\AuctionatorConfig.lua:591: attempt to index field '?' (a nil value)
Auctionator\AuctionatorConfig.lua:591: in function `Atr_Memorize_Save'
[string ":OnClick"]:1: in function <[string ":OnClick"]:1>

Locals:
x = 0
plist =

{
1 =
{
}
2 =
{
}
3 =
{
}
4 =
{
}
5 =
{
}
6 =
{
}
7 =
{
}
}
key = ""
(_temporary) = nil
(_temporary) = ""
(_temporary) = nil
(_temporary) = nil
(*temporary) = "attempt to index field '?' (a nil value)"
zz = defined @Auctionator\zcUtils.lua:636
gStackList_SelectedIndex = 0
gStackList_plist =
{
1 =
{
}
2 =
{
}
3 =
{
}
4 =
{
}
5 =
{
}
6 =
{
}
7 =
{
}
}

commented

Possible fix.

AuctiontorConfig.lua

add above function named Atr_Memorize_Save()

StaticPopupDialogs["ATR_MEMORIZE_TEXT_BLANK"] = {
  text = "",
  button1 = OKAY,
  OnAccept = function(self)
    Atr_Memorize_Show(true)
    return
  end,
  OnShow = function(self)
    local s = string.format (ZT("Item Name must not be blank"));
    self.text:SetText("\n"..s.."\n");
  end,
  timeout = 0,
  exclusive = 1,
  whileDead = 1,
  hideOnEscape = 1
};

Modify function Atr_Memorize_Save()

remove key = plist[x].sortkey;

function Atr_Memorize_Save()

  zz ("Saving stacking configuration");

  local x   = gStackList_SelectedIndex;
  local plist = gStackList_plist;

  local key = Atr_Mem_EB_itemName:GetText();
  if (key == nil or key == "") then
  StaticPopup_Show("ATR_MEMORIZE_TEXT_BLANK")
  end

  if (key and key ~= "") then
    Atr_Set_StackingPrefs_numstacks (key, UIDropDownMenu_GetSelectedValue (Atr_Mem_DD_numStacks));
    Atr_Set_StackingPrefs_stacksize (key, Atr_Mem_EB_stackSize:GetNumber());
  end

  Atr_StackingList_Display();

end

Add into enUS.lua

line 144 after AtrL["Really delete the shopping list %s ?"] = ""

add
AtrL["Entry must not be blank"] = ""

this creates a static popup with a single okay button that warns the entry must not be blank. Users can still enter in "" but since that technically is a valid text entry, I did not code to block it even though it will not provide a filter (did not think it necessary to start rejecting invalid text entries, just prevent the error of a blank one.

Can issue a pull request if this looks right.