(svn r14935) -Fix [FS#2498]: the new operator may not return NULL, so don't.

This commit is contained in:
rubidium
2009-01-09 15:01:15 +00:00
parent a5e835ab89
commit ee45f0fb03
2 changed files with 11 additions and 5 deletions

View File

@@ -11,7 +11,8 @@
* Allocate a pool item; possibly allocate a new block in the pool.
* @param first the first pool item to start searching
* @pre first <= Tpool->GetSize()
* @return the allocated pool item (or NULL when the pool is full).
* @pre CanAllocateItem()
* @return the allocated pool item
*/
template<typename T, typename Tid, OldMemoryPool<T> *Tpool> T *PoolItem<T, Tid, Tpool>::AllocateSafeRaw(uint &first)
{
@@ -31,7 +32,8 @@ template<typename T, typename Tid, OldMemoryPool<T> *Tpool> T *PoolItem<T, Tid,
/* Check if we can add a block to the pool */
if (Tpool->AddBlockToPool()) return AllocateRaw(first);
return NULL;
/* One should *ALWAYS* be sure to have enough space before making vehicles! */
NOT_REACHED();
}
/**