Merge pull request #12329 from jeromecoutant/PR_ATCELL

AT_CellularStack: crash during TCP test
pull/12472/head
Martin Kojtal 2020-02-03 17:00:00 +00:00 committed by GitHub
commit 586341541c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -429,8 +429,10 @@ void AT_CellularStack::socket_attach(nsapi_socket_t handle, void (*callback)(voi
int AT_CellularStack::get_socket_index_by_port(uint16_t port)
{
for (int i = 0; i < _device.get_property(AT_CellularDevice::PROPERTY_SOCKET_COUNT); i++) {
if (_socket[i]->localAddress.get_port() == port) {
return i;
if (_socket[i] != 0) {
if (_socket[i]->localAddress.get_port() == port) {
return i;
}
}
}
return -1;