Create a null element and return it

This commit is contained in:
Alex 2023-02-26 10:56:11 +02:00
parent 5427e7f2ca
commit 7b756263c0
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
2 changed files with 18 additions and 2 deletions

View File

@ -113,7 +113,14 @@ namespace NetworkInterfaceManager
DbgWriteScreen("DNS: %s", dhcp->DomainNameSystem.v4.ToStringLittleEndian());
TaskManager->Sleep(200);
/* TODO: This is a quick workaround we need DNS resolver asap. IP is time-a-g.nist.gov; https://tf.nist.gov/tf-cgi/servers.cgi */
/* TODO: This is a quick workaround we need DNS resolver asap.
https://tf.nist.gov/tf-cgi/servers.cgi
https://www.ntppool.org
- 0.ro.pool.ntp.org ( {86, 127, 71, 168} )
- time-a-g.nist.gov ( {129, 6, 15, 28} )
*/
InternetProtocol ip = {.v4 = {.Address = {129, 6, 15, 28}},
.v6 = {.Address = {}}};
NetworkUDP::Socket *NTP_Socket = udp->Connect(ip, 123);

View File

@ -149,7 +149,16 @@ public:
VectorSize = Size;
}
__no_instrument_function T &operator[](size_t Index) { return VectorBuffer[Index]; }
__no_instrument_function T &operator[](size_t Index)
{
if (!reinterpret_cast<uintptr_t>(&VectorBuffer[Index]))
{
warn("operator[]( %lld ) is null (requested by %#lx)", Index, __builtin_return_address(0));
static T null_elem;
return null_elem;
}
return VectorBuffer[Index];
}
__no_instrument_function Vector<T> &operator=(const Vector<T> &Vector)
{