Skip to content

fix: Handle null reference when Voice State is still in cache, but the channel it belongs to has been expired #1648

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? No Sign in to your account

Merged
merged 2 commits into from
Apr 26, 2024

Conversation

silasary
Copy link
Member

@silasary silasary commented Mar 31, 2024

Pull Request Type

  • Feature addition
  • Bugfix
  • Documentation update
  • Code refactor
  • Tests improvement
  • CI/CD pipeline enhancement
  • Other: [Replace with a description]

Description

If you have a particularly small expiry for the channel cache, or someone stays in a Voice Channel for a particularly long time, you can end up with a situation where the Voice State is cached, but the associated channel is not.
This leads to a fun null reference exception when the user eventually does leave the channel.

Changes

Adds a check that state.channel is not None.

Related Issues

Fixes #1644

Test Scenarios

Python Compatibility

  • I've ensured my code works on Python 3.10.x
  • I've ensured my code works on Python 3.11.x

Checklist

  • I've run the pre-commit code linter over all edited files
  • I've tested my changes on supported Python versions
  • I've added tests for my code, if applicable
  • I've updated / added documentation, where applicable

…e channel it belongs to has been expired

Fixes #1644
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 46.11%. Comparing base (af9866f) to head (3bcaaee).
Report is 2 commits behind head on unstable.

Files Patch % Lines
interactions/client/smart_cache.py 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##           unstable    #1648   +/-   ##
=========================================
  Coverage     46.11%   46.11%           
=========================================
  Files           147      147           
  Lines         15638    15638           
=========================================
  Hits           7211     7211           
  Misses         8427     8427           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@silasary silasary merged commit b903d54 into unstable Apr 26, 2024
9 of 12 checks passed
@silasary silasary deleted the fix-1644 branch April 26, 2024 15:16
No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants