Skip to content

Commit 5f4d001

Browse files
committed
Fix error with third party Wiimote poweroff
1 parent 760c7e0 commit 5f4d001

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lwbt/l2cap.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,10 @@ void l2cap_process_sig(struct pbuf *q, struct l2cap_hdr *l2caphdr, struct bd_add
293293

294294
switch(sighdr->code) {
295295
case L2CAP_CMD_REJ:
296+
if(pcb == NULL) {
297+
/* A rejection without a matching PCB is silently discarded */
298+
break;
299+
}
296300
/* Remove signal from unresponded list and deallocate it */
297301
L2CAP_SIG_RMV(&(pcb->unrsp_sigs), sig);
298302
btpbuf_free(sig->p);
@@ -701,7 +705,7 @@ void l2cap_process_sig(struct pbuf *q, struct l2cap_hdr *l2caphdr, struct bd_add
701705
/* Give upper layer indication */
702706
pcb->state = L2CAP_CLOSED;
703707
LOG("l2cap_process_sig: Disconnection request\n");
704-
L2CA_ACTION_DISCONN_IND(pcb,ERR_OK,ret);
708+
L2CA_ACTION_DISCONN_IND(pcb,ERR_OK,ret);
705709
}
706710
}
707711
break;

0 commit comments

Comments
 (0)