-
Notifications
You must be signed in to change notification settings - Fork 22
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
delete crash #97
Comments
Hm, this looks like the player doesn't have mails in the inbox to iterate through: Line 119 in fab6f1a
😕 (or maybe they are deleted already...) EDIT: you might have to add a for i = #entry.inbox, 1, -1 do
for _, deleted_msg in ipairs(msg_ids) do
if entry.inbox[i].id == deleted_msg then
table.remove(entry.inbox, i)
break -- <<<<
end
end
end otherwise it might remove multiple messages in a single pass of the outer loop ( See #98 for a partial fix |
@BuckarooBanzay you're removing the multiple deletion system by adding a break. I just added a verification of entry lengths, and it is fixed. |
* partial fox for #97 * Fix #97 --------- Co-authored-by: BuckarooBanzay <[email protected]> Co-authored-by: Athozus <[email protected]>
yeah, a break from the inner loop, the outer still loops and removes all selected messages... |
Anyway, what @Athozus added does not actually do anything. For loop mechanisms already work as same expressions: Loop is never executed if table is empty. On the other hand @BuckarooBanzay's commit does actually fix issue which basically is preventing from continuing operation on thing that is already removed in inner loop |
Sorry, my bad, I was too fast. @S-S-X I do not think it does anything, when you have a 0 length it does a weird thing. |
Just try it yourself, it is basic Lua and nothing else. Loop block is either executed or not and if table is empty it is not executed, If you do not believe your eyes then just try it. Reason for crash is in inner loop which attempts to index past outer loop table after first removal. (best thing to do would be to implement filter-by-shift method discussed on Discord but above stands if going to patch current methods) |
should be fixed with #99 otherwise reopen please |
* partial fox for #97 * Fix #97 --------- Co-authored-by: BuckarooBanzay <[email protected]> Co-authored-by: Athozus <[email protected]>
using the most recent version (fab6f1a)
the user reports:
The text was updated successfully, but these errors were encountered: