Add null check to avoid crash when failed to create RawSocket.