Skip to content

Commit

Permalink
Fix scenario migration
Browse files Browse the repository at this point in the history
The player may be created before the UI migrations have run, in which case we will attempt to update the filter buttons and fail utterly. Prevent this from happening.
  • Loading branch information
narc0tiq committed Dec 30, 2024
1 parent dea812d commit 7ad814b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions resmon/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ end
---@param player LuaPlayer Whose filters are we updating?
function ui_module.update_filter_buttons(player)
local player_data = storage.player_data[player.index]
-- In extreme cases, the `player_data.ui` might not have been initialized yet (e.g., scenario from an old version)
if not player_data.ui then
return -- We cannot proceed in this case
end

if not player_data.ui.active_filter then
player_data.ui.active_filter = ui_module.FILTER_WARNINGS
end
Expand Down

0 comments on commit 7ad814b

Please sign in to comment.