Skip to content
This repository has been archived by the owner on Sep 4, 2022. It is now read-only.

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

Open
bottiger1 opened this issue May 4, 2022 · 2 comments
Open

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

bottiger1 opened this issue May 4, 2022 · 2 comments
Labels
Bug Something isn't working

Comments

@bottiger1
Copy link

bottiger1 commented May 4, 2022

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.

  • Check if the timer is null before deleting

delete FF2PlayerInfo[client].MusicTimer;

  • Check if timer is null first and delete first

FF2PlayerInfo[client].MusicTimer = CreateTimer(time, Timer_PrepareBGM, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);

  • Set the variable to null here after these lines. KillTimer does not set the variable to null, unlike delete.

KillTimer(FF2PlayerInfo[param1].MusicTimer);

KillTimer(FF2PlayerInfo[param1].MusicTimer);

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

@bottiger1 bottiger1 added the Bug Something isn't working label May 4, 2022
@MAGNAT2645
Copy link
Contributor

i believe delete checks if Handle is null before closing it

@bottiger1
Copy link
Author

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;

delete FF2PlayerInfo[client].MusicTimer;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants