Skip to content

Commit

Permalink
fix(savegame): fix savefiles directory not being created (#5917)
Browse files Browse the repository at this point in the history
A refactor of the load/save UI in commit
7b6a797 introduced a bug preventing the
"savefiles" directory from getting created, and causing an error-popup
whenever the directory was attempted to be accessed by the LUA UI.

The bug was resetting a variable to an unexpected value which then
caused the "sort" algorithm to throw an error. This was resolved by
ensuring that the variable always had a valid value for the sort
algorithm.
  • Loading branch information
mwerle authored and Web-eWorks committed Sep 26, 2024
1 parent dfa01e2 commit 73b8306
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions data/pigui/modules/saveloadgame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ function SaveLoadWindow:makeFileList()
if not ok then
Notification.add(Notification.Type.Error, lui.COULD_NOT_LOAD_SAVE_FILES, files --[[@as string]])
self.files = {}
else
self.files = files
end

self.files = files

table.sort(self.files, function(a, b)
return a.mtime.timestamp > b.mtime.timestamp
end)
Expand Down

0 comments on commit 73b8306

Please sign in to comment.