Skip to content

Fix Overlay Throwing Errors#121

Merged
Lexer747 merged 3 commits intongraves95:mainfrom
Lexer747:pr-92-fix-error
Mar 27, 2026
Merged

Fix Overlay Throwing Errors#121
Lexer747 merged 3 commits intongraves95:mainfrom
Lexer747:pr-92-fix-error

Conversation

@Lexer747
Copy link
Copy Markdown
Collaborator

Summary

As reported by #92 (but I personally didn't encounter until #87 was merged) when the HD bar is empty it will spam the logs with exceptions.

Looking at what causes this it's two things:

  • When the bar is nearly empty:
    • Ratio can be negative depending on the settings
    • If the ratio is negative then negative pixels are requested for the sub image
  • When the bar is actually empty:
    • progressFill is 0 which asks for a 0 width sub image

Therefore to make the code more robust ratio is always clamped between 0 and 1. And when progressFill is less than or equal to 1 we should just not draw the second image. (which was what was already happening if you think about because the exception is complaining it can't draw an image).


Aside: updated the copyright (git history) and formatting of the file.

Testing

A minute of gargoyle killing flicking through the settings showing the RL logs and the lack of spam :)

https://www.youtube.com/watch?v=WBdZh-M7X_c

@Lexer747
Copy link
Copy Markdown
Collaborator Author

@PedroSilvaAlves since you've worked in this area before please let me know if this makes sense to you also.

@Lexer747 Lexer747 requested a review from ngraves95 March 19, 2026 20:57
// if progress is less than 1 then there's no "sub-bar" to draw as it would either have fractional
// pixels (not possible) or negative pixels (also not possible) fixes
// (https://github.com/ngraves95/attacktimer/issues/92)
if (progressFill <= 1)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Should this check for < 1 instead of <= 1? progressFill == 1 seems like a valid config to render

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah that's probably more correct, my own comment even would indicate that 😅

@Lexer747
Copy link
Copy Markdown
Collaborator Author

@PedroSilvaAlves another ping, as I'd appreciate your input 😁

@PedroSilvaAlves
Copy link
Copy Markdown
Contributor

Sorry for the delay, looks good to me, appreciate the fix. Thank you!

@Lexer747 Lexer747 merged commit ed74c15 into ngraves95:main Mar 27, 2026
1 check passed
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