Luffyyy / HoloUI

A clean and highly customizable UI for payday 2
MIT License
19 stars 15 forks source link

Crash at startup rigth after fresh install. #85

Closed Rremingegk closed 5 years ago

Rremingegk commented 5 years ago

Title. Application has crashed: C++ exception mods/Holo/Classes/Utils.lua:49: attempt to index field '_panel' (a nil value)

SCRIPT STACK

func() @mods/Holo/Hooks/Menu/MenuComponentManager.lua:6 register_component() @mods/base/req/core/Hooks.lua:267 create() lib/managers/menu/menucomponentmanager.lua:4823 set_active_components() lib/managers/menu/menucomponentmanager.lua:481 set_active_components() @mods/base/lua/MenuComponentManager.lua:19 core/lib/managers/menu/coremenulogic.lua:89 _execute_action_queue() core/lib/managers/menu/coremenulogic.lua:54 update() core/lib/managers/menu/coremenulogic.lua:64 update() core/lib/managers/menu/coremenumanager.lua:155 update() lib/managers/menumanagerpd2.lua:20 update() lib/setups/setup.lua:854 update() lib/setups/menusetup.lua:340 update() @mods/base/lua/MenuSetup.lua:6 core/lib/setups/coresetup.lua:540

Luffyyy commented 5 years ago

You're running any other mods perhaps? Need to know so I could test this.

Curve commented 5 years ago

I had this crash too, dont know why it happens, but "_panel" is nil. If you dump the "this" table it still has a valid reference to a panel, but the panel it self seems to be nil. So I just commtented out the whole function and it doesnt seem to change anything but it fixes the crash. Just go into Holo/Classes/Utils.lua and replace the function with this code:


function Utils:FixBackButton(this, back_button)
    --[[if not back_button then
        if type(this._back_button) == "table" then
            back_button = this._back_button._text
        else
            back_button = this._panel:child("back_button")
        end
        if not back_button then
            back_button = this._panel:child("BackButton")
        end
    end

    if type_name(back_button)  == "Panel" then
        back_button = back_button:child("label")
    end

    if type_name(back_button) ~= "Text" then
        return
    end

    local really_ugly_button = this._fullscreen_panel and this._fullscreen_panel:child("back_button")
    if alive(really_ugly_button) then
        really_ugly_button:hide()
        really_ugly_button:set_w(0)
    end

    if not managers.menu:is_pc_controller() or not alive(back_button) then
        return
    end

    this._fixed_back_button = back_button
    back_button:configure({
        color = Holo:GetColor("TextColors/Menu"),
        font_size = 24,
        blend_mode = "normal"
    })
    back_button:set_shape(back_button:text_rect())  
    this._back_marker = back_button:parent():rect({
        color = Holo:GetColor("Colors/Marker"),
        w = 2,
        h = back_button:h(),
        rotation = 360,
        alpha = 0,
        layer = back_button:layer() - 1
    })
    this._back_marker:set_world_rightbottom(back_button:parent():world_rightbottom())
    back_button:set_rightbottom(this._back_marker:leftbottom())
    Holo:Post(this, "mouse_moved", function(this, o, x, y)
        local highlight = this._fixed_back_button:inside(x, y)
        this._back_button_highlighted = highlight
        this.back_button_highlighted = highlight
        this._fixed_back_button:stop()
        play_color(this._fixed_back_button, Holo:GetColor(highlight and "TextColors/MenuHighlighted" or "TextColors/Menu"))
        play_value(this._back_marker, "alpha", highlight and 1 or 0)
    end)--]]
end