Mod template error in Utlbuffer.cpp

Grab your favourite IDE and tinker with the innards of game engines

Mod template error in Utlbuffer.cpp

Postby city14 on Wed Jun 17, 2009 1:46 am

I'm getting an assert error in UtlBuffer.cpp

assertion failed nSize!=0

Here's the code block I'm assuming the error stems from...

Code: Select all
//-----------------------------------------------------------------------------
// constructors
//-----------------------------------------------------------------------------
CUtlBuffer::CUtlBuffer( int growSize, int initSize, int nFlags ) :
   m_Memory( growSize, initSize ), m_Error(0)
{
   m_Get = 0;
   m_Put = 0;
   m_nTab = 0;
   m_nOffset = 0;
   m_Flags = nFlags;
   if ( (initSize != 0) && !IsReadOnly() )
   {
      m_nMaxPut = -1;
      AddNullTermination();
   }
   else
   {
      m_nMaxPut = 0;
   }
   SetOverflowFuncs( &CUtlBuffer::GetOverflow, &CUtlBuffer::PutOverflow );
}

CUtlBuffer::CUtlBuffer( const void *pBuffer, int nSize, int nFlags ) :
   m_Memory( (unsigned char*)pBuffer, nSize ), m_Error(0)
{
   Assert( nSize != 0 );  < - Right here is where it said it broke line 220

   m_Get = 0;
   m_Put = 0;
   m_nTab = 0;
   m_nOffset = 0;
   m_Flags = nFlags;
   if ( IsReadOnly() )
   {
      m_nMaxPut = nSize;
   }
   else
   {
      m_nMaxPut = -1;
      AddNullTermination();
   }
   SetOverflowFuncs( &CUtlBuffer::GetOverflow, &CUtlBuffer::PutOverflow );
}


Anyone know how to fix this?
coder0xff wrote:I wonder if Gabe ever lies in bed at night, thinking about all the fat jokes, and just cries himself to sleep, wiping his tears away with one-thousand dollar bills.
User avatar
city14
Pheropod
Pheropod
 
Joined: Tue Jun 16, 2009 8:35 pm
Location: Troutdale, Oregon

Re: Mod template error in Utlbuffer.cpp

Postby zombie@computer on Wed Jun 17, 2009 7:24 am

simple. Dont create CUtlBuffer with a zero size. Quite pointless to create one with 0 length, hence the Assertion was placed.

The cause is not in this code. Somewhere you are saying CUtlBuffer b = new CUtlBuffer( buff, 0, flags); which is wrong.
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Re: Mod template error in Utlbuffer.cpp

Postby city14 on Wed Jun 17, 2009 9:19 am

K, thanks! Didn't realize how noobish that was...
coder0xff wrote:I wonder if Gabe ever lies in bed at night, thinking about all the fat jokes, and just cries himself to sleep, wiping his tears away with one-thousand dollar bills.
User avatar
city14
Pheropod
Pheropod
 
Joined: Tue Jun 16, 2009 8:35 pm
Location: Troutdale, Oregon

Re: Mod template error in Utlbuffer.cpp

Postby moeabm on Thu Feb 07, 2013 8:02 pm

This is a old thread but

https://developer.valvesoftware.com/wik ... buffer.cpp

Turns out, these ARE the drones you are looking for.
moeabm
Just Joined
Just Joined
 
Joined: Thu Feb 07, 2013 7:58 pm

Return to Programming

Who is online

Users browsing this forum: No registered users