Skip to content

Commit c71d32f

Browse files
Fix nil pointer dereference in handleSerialChannel by adding a check for the port before reading data. (#1141)
1 parent 5edba66 commit c71d32f

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

serial.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,10 @@ func handleSerialChannel(d *webrtc.DataChannel) {
290290

291291
d.OnOpen(func() {
292292
go func() {
293+
if port == nil {
294+
return
295+
}
296+
293297
buf := make([]byte, 1024)
294298
for {
295299
n, err := port.Read(buf)

0 commit comments

Comments
 (0)