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:
riccardom 2010-04-18 15:59:27 +00:00
parent 09b06acd47
commit 012bf26764
1 changed files with 3 additions and 1 deletions

View File

@ -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;