Commit 9cee046a authored by Sean McBride's avatar Sean McBride
Browse files

Check ResizeAndExtend error result and bail

Fixes clang analyzer warning about null deref.

Change-Id: I90104cb6cbc643800ab70dc48bf9470e9420eaad
parent e0c279f4
......@@ -280,7 +280,10 @@ inline void vtkBitArray::InsertValue(vtkIdType id, int i)
{
if ( id >= this->Size )
{
this->ResizeAndExtend(id+1);
if (!this->ResizeAndExtend(id+1))
{
return;
}
}
if (i)
{
......
......@@ -152,7 +152,10 @@ inline vtkIdType vtkIdList::InsertNextId(const vtkIdType vtkid)
{
if ( this->NumberOfIds >= this->Size )
{
this->Resize(this->NumberOfIds+1);
if (!this->Resize(this->NumberOfIds+1))
{
return this->NumberOfIds-1;
}
}
this->Ids[this->NumberOfIds++] = vtkid;
return this->NumberOfIds-1;
......
......@@ -456,7 +456,10 @@ void vtkStringArray::InsertValue(vtkIdType id, vtkStdString f)
{
if ( id >= this->Size )
{
this->ResizeAndExtend(id+1);
if (!this->ResizeAndExtend(id+1))
{
return;
}
}
this->Array[id] = f;
if ( id > this->MaxId )
......
......@@ -639,7 +639,10 @@ void vtkVariantArray::InsertValue(vtkIdType id, vtkVariant value)
{
if ( id >= this->Size )
{
this->ResizeAndExtend(id+1);
if (!this->ResizeAndExtend(id+1))
{
return;
}
}
this->Array[id] = value;
if ( id > this->MaxId )
......
......@@ -98,7 +98,10 @@ void vtkVoidArray::InsertVoidPointer(vtkIdType id, void* p)
{
if ( id >= this->Size )
{
this->ResizeAndExtend(id+1);
if (!this->ResizeAndExtend(id+1))
{
return;
}
}
this->Array[id] = p;
if ( id >= this->NumberOfPointers )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment