more correct proxyID validation

This commit is contained in:
Andrew Meadows 2018-04-06 15:35:17 -07:00
parent f996989a40
commit b523b2a81a

View file

@ -121,14 +121,15 @@ uint32_t Space::copyProxyValues(Proxy* proxies, uint32_t numDestProxies) const {
const Owner Space::getOwner(int32_t proxyID) const { const Owner Space::getOwner(int32_t proxyID) const {
std::unique_lock<std::mutex> lock(_proxiesMutex); std::unique_lock<std::mutex> lock(_proxiesMutex);
if (_IDAllocator.checkIndex(proxyID)) { if (isAllocatedID(proxyID) && (proxyID < (Index)_proxies.size())) {
return _owners[proxyID]; return _owners[proxyID];
} }
return Owner(); return Owner();
} }
uint8_t Space::getRegion(int32_t proxyID) const { uint8_t Space::getRegion(int32_t proxyID) const {
if (_IDAllocator.checkIndex(proxyID)) { std::unique_lock<std::mutex> lock(_proxiesMutex);
if (isAllocatedID(proxyID) && (proxyID < (Index)_proxies.size())) {
return _proxies[proxyID].region; return _proxies[proxyID].region;
} }
return (uint8_t)Region::INVALID; return (uint8_t)Region::INVALID;