ap: check that the last band_freq_attrs was set

Static analysis complains that 'last' could be NULL which is true.
This really could only happen if every frequency was disabled which
likely is impossible but in any case, check before dereferencing
the pointer.
This commit is contained in:
James Prestwood 2024-02-29 10:12:13 -08:00 committed by Denis Kenzior
parent 83c032a583
commit 338577bb3a
1 changed files with 4 additions and 2 deletions

View File

@ -1247,8 +1247,10 @@ static size_t ap_build_country_ie(struct ap_state *ap, uint8_t *out_buf,
}
/* finish final group */
*pos++ = nchans;
*pos++ = last->tx_power;
if (last) {
*pos++ = nchans;
*pos++ = last->tx_power;
}
len = pos - out_buf - 2;