Skip to content

Commit a2cc884

Browse files
committed
[OneBot] Fix Corruption of ForwardWSService.cs
1 parent 0a3e8cf commit a2cc884

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Lagrange.OneBot/Core/Network/Service/ForwardWSService.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,17 @@ public async ValueTask SendJsonAsync<T>(T json, string? identifier = null, Cance
126126

127127
private void OnHeartbeat(object? _, string identifier)
128128
{
129-
var status = new OneBotStatus(true, true);
130-
var heartBeat = new OneBotHeartBeat(_context.BotUin, (int)_options.HeartBeatInterval, status);
129+
try
130+
{
131+
var status = new OneBotStatus(true, true);
132+
var heartBeat = new OneBotHeartBeat(_context.BotUin, (int)_options.HeartBeatInterval, status);
131133

132-
SendJsonAsync(heartBeat, identifier).GetAwaiter().GetResult();
134+
SendJsonAsync(heartBeat, identifier).GetAwaiter().GetResult();
135+
}
136+
catch
137+
{
138+
// ignored
139+
}
133140
}
134141

135142
private static bool IsPortInUse(uint port) =>

0 commit comments

Comments
 (0)