Skip to content

Commit

Permalink
Fix crash when changing ship type
Browse files Browse the repository at this point in the history
  • Loading branch information
Web-eWorks committed Jan 16, 2022
1 parent 3e46211 commit dfbd396
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions data/pigui/modules/info-view/01-ship-info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ local Event = require 'Event'
local Game = require 'Game'
local Lang = require 'Lang'
local ShipDef = require 'ShipDef'
local ModelSpinner = require 'PiGui.Modules.ModelSpinner'
local InfoView = require 'pigui.views.info-view'
local Vector2 = Vector2

Expand All @@ -16,7 +15,6 @@ local l = Lang.GetResource("ui-core")
local fonts = ui.fonts
local textTable = require 'pigui.libs.text-table'


local equipmentWidget = require 'pigui.libs.ship-equipment'.New("ShipInfo")

local function shipStats()
Expand Down Expand Up @@ -117,5 +115,8 @@ InfoView:registerView({
})

Event.Register("onShipTypeChanged", function(ship)
if ship == Game.player then equipmentWidget:refresh() end
if ship == Game.player then
equipmentWidget.ship = Game.player
equipmentWidget:refresh()
end
end)

0 comments on commit dfbd396

Please sign in to comment.