bluetooth/btstack/linkmgr/hostmbufpool.cpp
changeset 51 20ac952a623c
parent 48 22de2e391156
--- a/bluetooth/btstack/linkmgr/hostmbufpool.cpp	Thu Sep 23 17:06:47 2010 +0300
+++ b/bluetooth/btstack/linkmgr/hostmbufpool.cpp	Wed Oct 13 16:20:29 2010 +0300
@@ -146,9 +146,7 @@
 	// Speculatively attempt to allocate any queued allocations that may have previously failed.
 	TryToAllocQueuedBuffer();
 	
-	TPoolBuffer* ready = iBufferPool.First();
-	
-	if(!ready)
+	if(iBufferPool.IsEmpty())
 		{
 		// Whoops run out of buffers - even though we were trying to prevent this with
 		// flow control, in the case of disconnection the controller will assume all the
@@ -161,7 +159,9 @@
 		LOG(_L8("CHostMBufPool: Ran out of buffers!!!!"));
 		LEAVEL(KErrOverflow);
 		}
-	
+
+	TPoolBuffer* ready = iBufferPool.First();
+
 	// If here then we should have a valid pool buffer to use
 	__ASSERT_DEBUG(!ready->iMBufChain.IsEmpty(), Panic(ELinkMgrHostControllerHasOverflowedHost));
 	__ASSERT_DEBUG(ready->iCurrentHandle == KInvalidConnectionHandle, Panic(ELinkMgrHostControllerHasOverflowedHost));