@@ -968,33 +968,43 @@ function TradeQueryClass:PriceItemRowDisplay(row_idx, top_pane_alignment_ref, ro
968968 self :SetNotice (context .controls .pbNotice , " " )
969969 end
970970
971+ -- ensure we only take in items that parse properly to avoid crash issues.
972+ local itemsSafe = {}
973+ for _ , entry in ipairs (items ) do
974+ local item = new (" Item" , entry .item_string )
975+ if item .base then
976+ t_insert (itemsSafe , entry )
977+ end
978+ end
979+
971980 if self .tradeQueryGenerator .lastAugmentBehaviour == " Copy Current" or self .tradeQueryGenerator .lastAnointBehaviour == " Copy Current" then
972- for i , _ in ipairs (items ) do
973- local item = new (" Item" , items [i ].item_string )
974- if item .base then
981+ for i , _ in ipairs (itemsSafe ) do
982+ local item = new (" Item" , itemsSafe [i ].item_string )
983+ -- avoid interacting with badly parsed stuff
984+ if item .base and item .type then
975985 self .itemsTab :CopyAnointsAndAugments (item , true , true , context .slotTbl .slotName )
986+ itemsSafe [i ].item_string = item :BuildRaw ()
976987 end
977- items [i ].item_string = item :BuildRaw ()
978988 end
979989 elseif self .tradeQueryGenerator .lastAugmentBehaviour == " Remove" then
980- for item_idx , _ in ipairs (items ) do
981- local item = new (" Item" , items [item_idx ].item_string )
990+ for item_idx , _ in ipairs (itemsSafe ) do
991+ local item = new (" Item" , itemsSafe [item_idx ].item_string )
982992 -- sockets are kept as-is so the user can see e.g. exceptional or corrupted sockets
983993 for rune_idx , _ in ipairs (item .runes or {}) do
984994 item .runes [rune_idx ] = " None"
985995 end
986996 item :UpdateRunes ()
987- items [item_idx ].item_string = item :BuildRaw ()
997+ itemsSafe [item_idx ].item_string = item :BuildRaw ()
988998 end
989999 elseif self .tradeQueryGenerator .lastAnointBehaviour == " Remove" then
990- for i , _ in ipairs (items ) do
991- local item = new (" Item" , items [i ].item_string )
1000+ for i , _ in ipairs (itemsSafe ) do
1001+ local item = new (" Item" , itemsSafe [i ].item_string )
9921002 item .enchantModLines = {}
993- items [i ].item_string = item :BuildRaw ()
1003+ itemsSafe [i ].item_string = item :BuildRaw ()
9941004 end
9951005 end
9961006
997- self .resultTbl [context .row_idx ] = items
1007+ self .resultTbl [context .row_idx ] = itemsSafe
9981008 self :UpdateControlsWithItems (context .row_idx )
9991009 context .controls [" priceButton" .. context .row_idx ].label = " Price Item"
10001010 end ,
0 commit comments