Skip to content

Fix division by zero on instant leave replays#198

Merged
StoicLoofah merged 1 commit into
ggtracker:upstreamfrom
manuelseeger:fixapmdivbyzero
Dec 28, 2023
Merged

Fix division by zero on instant leave replays#198
StoicLoofah merged 1 commit into
ggtracker:upstreamfrom
manuelseeger:fixapmdivbyzero

Conversation

@manuelseeger

Copy link
Copy Markdown
Contributor

On an instant leave there can be a division by zero.

If a player does an action and leaves the game just when the game clocks from second 0 to second 1 there can be a condition where apm > 0 but second == 0, resulting in a division by zero on line 131.

Example replay:
NeoHumanity LE (279).zip

@manuelseeger

Copy link
Copy Markdown
Contributor Author

I did not change anything on

./examples/sc2autosave.py
./sc2reader/engine/plugins/creeptracker.py

The failing style checks come from upstream.

@cclauss

cclauss commented Dec 28, 2023

Copy link
Copy Markdown
Collaborator

The typos are easy to fix.

./examples/sc2autosave.py:80: Mutliplayer ==> Multiplayer
./examples/sc2autosave.py:88: Mutliplayer ==> Multiplayer
./examples/sc2autosave.py:99: Mutliplayer ==> Multiplayer
./examples/sc2autosave.py:115: Mutliplayer ==> Multiplayer
./sc2reader/engine/plugins/creeptracker.py:108: minite ==> minute

@StoicLoofah StoicLoofah left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants