Skip to content

Resolve KeyNotFoundException and Enhance Bot Handling in Free Game Collection#71

Merged
maxisoft merged 2 commits intomainfrom
dev
May 11, 2024
Merged

Resolve KeyNotFoundException and Enhance Bot Handling in Free Game Collection#71
maxisoft merged 2 commits intomainfrom
dev

Conversation

@maxisoft
Copy link
Copy Markdown
Owner

Overview

This pull request addresses the KeyNotFoundException during the scheduled free game collection process and implements enhancements to bot handling. The changes are a direct response to the issue reported in #70.

Changes

  • ASFFreeGamesPlugin.cs: Introduced a pre-check for viable bots before initiating the free game collection command to prevent attempts to access keys that do not exist in the bot dictionary.
  • FreeGamesCommand.cs: Refined bot collection handling by trimming bot names to eliminate whitespace issues and employing GetValueOrDefault for safer retrieval of bot instances, thereby avoiding potential exceptions.
  • Command Handling: The HandleInternalCollectCommand method now provides a more detailed response, clearly stating the total number of games collected and enumerating the bots that participated in the operation.

Impact

These improvements are expected to significantly increase the stability and reliability of the free game collection feature within ASF, ensuring smoother operations and better user experience.

Additional Notes

  • Version bump to 1.5.2 to reflect the new changes and fixes.

maxisoft added 2 commits May 11, 2024 11:27
This commit resolves the `KeyNotFoundException` encountered during the scheduled free game collection process. The issue was caused by an attempt to access a non-existent key in the bot dictionary, as reported in issue #70.

Changes include:
- Added a check in `ASFFreeGamesPlugin.cs` to ensure there are viable bots before proceeding with the free game collection command.
- Modified `FreeGamesCommand.cs` to handle bot collections more robustly, trimming bot names to prevent whitespace issues and using `GetValueOrDefault` to avoid exceptions when a bot name is not found.
- Updated the `HandleInternalCollectCommand` method to return a more informative response, indicating the number of collected games and the bots involved in the operation.

These updates aim to enhance the stability and reliability of the free game collection feature in ASF.
@maxisoft maxisoft added the bug Something isn't working label May 11, 2024
@maxisoft maxisoft self-assigned this May 11, 2024
@maxisoft maxisoft removed the bug Something isn't working label May 11, 2024
@maxisoft maxisoft merged commit 1e8c529 into main May 11, 2024
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.

1 participant