summaryrefslogtreecommitdiff
path: root/src/oldpool.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/oldpool.h')
-rw-r--r--src/oldpool.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/oldpool.h b/src/oldpool.h
index a21d5fb0a..ab496d2c3 100644
--- a/src/oldpool.h
+++ b/src/oldpool.h
@@ -287,6 +287,18 @@ struct PoolItem {
}
/**
+ * Get item with given index
+ * @param index item to get
+ * @return NULL for invalid items
+ */
+ static FORCEINLINE T *GetIfValid(uint index)
+ {
+ if (index >= Tpool->GetSize()) return NULL;
+ T *item = Tpool->Get(index);
+ return item->IsValid() ? item : NULL;
+ }
+
+ /**
* Returns size of the pool (in number of items)
* @return size of the pool
*/