Batfoxkid / FreakFortressBat

No longer supported.
https://github.com/Batfoxkid/Freak-Fortress-2-Rewrite
GNU General Public License v3.0
30 stars 20 forks source link

[Bug] Invalid timer at delete MusicTimer[client] #173

Open bottiger1 opened 2 years ago

bottiger1 commented 2 years ago

Description

Not sure how this happened, but the plugin tried to close an invalid timer on setup. And it stops the boss from ever being selected.

L 05/03/2022 - 20:33:03: [SM] Exception reported: Handle 53810b17 is invalid (error 3) L 05/03/2022 - 20:33:03: [SM] Blaming: freak_fortress_2.smx L 05/03/2022 - 20:33:03: [SM] Call stack trace: L 05/03/2022 - 20:33:03: [SM] [0] CloseHandle L 05/03/2022 - 20:33:03: [SM] [1] Line 5502, Unofficial Freak Fortress::StopMusic L 05/03/2022 - 20:33:03: [SM] [2] Line 3706, Unofficial Freak Fortress::OnRoundSetup

Reproduce

No idea how to reproduce

Recommendations

I recommend some code cleanup to try to prevent this from happening.

https://github.com/Batfoxkid/FreakFortressBat/blob/391af29d7944b19203992d3ca46fd9abafaee095/addons/sourcemod/scripting/impl/music.sp#L7

https://github.com/Batfoxkid/FreakFortressBat/blob/391af29d7944b19203992d3ca46fd9abafaee095/addons/sourcemod/scripting/impl/music.sp#L132

https://github.com/Batfoxkid/FreakFortressBat/blob/f07988f2d5cfc88401f8add75060feaafc1b4503/addons/sourcemod/scripting/impl/panels.sp#L1269

https://github.com/Batfoxkid/FreakFortressBat/blob/f07988f2d5cfc88401f8add75060feaafc1b4503/addons/sourcemod/scripting/impl/panels.sp#L1282

These lines are the only places I could find that could be an issue, but there could be more.

MAGNAT2645 commented 2 years ago

i believe delete checks if Handle is null before closing it

bottiger1 commented 2 years ago

Update:

For this line, it should check if client is 0. And outside the if statement it should set the musictimer to null.

MusicTimer[client] = null;

https://github.com/Batfoxkid/FreakFortressBat/blob/391af29d7944b19203992d3ca46fd9abafaee095/addons/sourcemod/scripting/impl/music.sp#L7