MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / AtOrNull

Method AtOrNull

engine/Poseidon/Foundation/Containers/Array.hpp:133–133  ·  view source on GitHub ↗

Release-checked element access for indices that originate off the wire. Unlike operator[]/Set/Get (whose AssertDebug compiles out under NDEBUG), this bounds-check survives in shipping builds: it returns nullptr instead of indexing out of range, so callers handling attacker-controlled indices can reject rather than read/write past it.

Source from the content-addressed store, hash-verified

131 // survives in shipping builds: it returns nullptr instead of indexing out of range, so
132 // callers handling attacker-controlled indices can reject rather than read/write past it.
133 Type* AtOrNull(int i) { return (i >= 0 && i < _n) ? &_data[i] : nullptr; }
134 const Type* AtOrNull(int i) const { return (i >= 0 && i < _n) ? &_data[i] : nullptr; }
135 const Type* Data() const { return _data; }
136 Type* Data() { return _data; }

Callers 2

OnMessagePlayerRoleMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected