prevent null dereference if no network device is selected in dev9

This commit is contained in:
Peter Tissen 2014-05-24 22:12:26 +02:00
parent f11877e72c
commit ad9ec44228
2 changed files with 14 additions and 6 deletions

View File

@ -171,8 +171,13 @@ s32 _DEV9open()
//ResumeThread (handleDEV9Thread);
NetAdapter* na=GetNetAdapter();
if (!na)
{
emu_printf("Failed to GetNetAdapter()\n");
InitNet( na);
}
else
{
InitNet(na);
}
return 0;
}

View File

@ -57,10 +57,13 @@ void InitNet(NetAdapter* ad)
}
void TermNet()
{
RxRunning=false;
emu_printf("Waiting for RX-net thread to terminate..");
WaitForSingleObject(rx_thread,-1);
emu_printf(".done\n");
if(RxRunning)
{
RxRunning = false;
emu_printf("Waiting for RX-net thread to terminate..");
WaitForSingleObject(rx_thread, -1);
emu_printf(".done\n");
delete nif;
delete nif;
}
}