Skip to content

Commit

Permalink
Fix crash on invalid message
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Nov 19, 2024
1 parent 1173f5e commit 2400638
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/networker/networker_socket/lib/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@ class NetworkerSocketServer extends NetworkerServer<NetworkerSocketInfo> {
// No free space
if (id == kAnyChannel) socket.close();
socket.listen((event) {
onMessage(event, id);
try {
if (event is String) {
event = Uint8List.fromList(event.codeUnits);
}
onMessage(event, id);
} catch (_) {}
}, onDone: () {
removeConnection(id);
});
Expand Down

0 comments on commit 2400638

Please sign in to comment.