Skip to content

Commit

Permalink
[OneBot] Does not throw exception when unsupported operation called
Browse files Browse the repository at this point in the history
  • Loading branch information
Linwenxuan authored and Linwenxuan committed Oct 25, 2023
1 parent 3bbbd45 commit 42ce36d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Lagrange.OneBot/Core/Operation/OperationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ private async Task HandleOperation(string data)

if (action != null)
{
var handler = _operations[action.Action];
var result = await handler.HandleOperation(action.Echo, _bot, action.Params);
await _service.SendJsonAsync(result);
bool supported = _operations.TryGetValue(action.Action, out var handler);

if (supported && handler != null)
{
var result = await handler.HandleOperation(action.Echo, _bot, action.Params);
await _service.SendJsonAsync(result);
}
}
else
{
Expand Down

0 comments on commit 42ce36d

Please sign in to comment.