Avoid segfault without available interfaces
On gnu/linux pcap_findalldevs can return 0 but provide a NULL interfaces list. This could be common on !windows because from what i can see normal users can't list devices :|.
This commit is contained in:
parent
09b06acd47
commit
012bf26764
|
@ -1930,8 +1930,10 @@ bool SoftAP_Init()
|
|||
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
pcap_if_t *alldevs;
|
||||
int ret;
|
||||
|
||||
if(driver->PCAP_findalldevs(&alldevs, errbuf) == -1)
|
||||
ret = driver->PCAP_findalldevs(&alldevs, errbuf);
|
||||
if (ret == -1 || alldevs == NULL)
|
||||
{
|
||||
WIFI_LOG(1, "SoftAP: PCap: failed to find any network adapter: %s\n", errbuf);
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue