Skip to content

Commit 5863415

Browse files
authored
Merge pull request #12329 from jeromecoutant/PR_ATCELL
AT_CellularStack: crash during TCP test
2 parents 62cc4ec + a1fb286 commit 5863415

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

features/cellular/framework/AT/AT_CellularStack.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,10 @@ void AT_CellularStack::socket_attach(nsapi_socket_t handle, void (*callback)(voi
429429
int AT_CellularStack::get_socket_index_by_port(uint16_t port)
430430
{
431431
for (int i = 0; i < _device.get_property(AT_CellularDevice::PROPERTY_SOCKET_COUNT); i++) {
432-
if (_socket[i]->localAddress.get_port() == port) {
433-
return i;
432+
if (_socket[i] != 0) {
433+
if (_socket[i]->localAddress.get_port() == port) {
434+
return i;
435+
}
434436
}
435437
}
436438
return -1;

0 commit comments

Comments
 (0)