Commit 8e17ee09 authored by Dave DeMarle's avatar Dave DeMarle
Browse files

Fix set get test.

Now that these kits are wrapped in tcl, the set/get smoke test
caught two return uninitialized ivar bugs.

Change-Id: I6a9092a9151171d1709279d79016010c6bcb351d
parent 99b9af87
......@@ -639,7 +639,11 @@ void vtkContext2D::ApplyPen(vtkPen *pen)
//-----------------------------------------------------------------------------
vtkPen* vtkContext2D::GetPen()
{
return this->Device->GetPen();
if (this->Device)
{
return this->Device->GetPen();
}
return NULL;
}
//-----------------------------------------------------------------------------
......@@ -651,7 +655,11 @@ void vtkContext2D::ApplyBrush(vtkBrush *brush)
//-----------------------------------------------------------------------------
vtkBrush* vtkContext2D::GetBrush()
{
return this->Device->GetBrush();
if (this->Device)
{
return this->Device->GetBrush();
}
return NULL;
}
//-----------------------------------------------------------------------------
......@@ -663,7 +671,11 @@ void vtkContext2D::ApplyTextProp(vtkTextProperty *prop)
//-----------------------------------------------------------------------------
vtkTextProperty* vtkContext2D::GetTextProp()
{
return this->Device->GetTextProp();
if (this->Device)
{
return this->Device->GetTextProp();
}
return NULL;
}
//-----------------------------------------------------------------------------
......@@ -678,8 +690,12 @@ void vtkContext2D::SetTransform(vtkTransform2D *transform)
//-----------------------------------------------------------------------------
vtkTransform2D* vtkContext2D::GetTransform()
{
this->Device->GetMatrix(this->Transform->GetMatrix());
return this->Transform;
if (this->Device && this->Transform)
{
this->Device->GetMatrix(this->Transform->GetMatrix());
return this->Transform;
}
return NULL;
}
//-----------------------------------------------------------------------------
......
......@@ -98,6 +98,11 @@ void vtkProgrammableElectronicData::SetNumberOfMOs(vtkIdType size)
//----------------------------------------------------------------------------
vtkImageData * vtkProgrammableElectronicData::GetMO(vtkIdType orbitalNumber)
{
if (orbitalNumber <= 0)
{
vtkWarningMacro(<< "Request for invalid orbital number "<<orbitalNumber);
return NULL;
}
if (orbitalNumber > static_cast<vtkIdType>(this->MOs->size()))
{
vtkWarningMacro(<< "Request for orbital number " << orbitalNumber
......@@ -117,6 +122,11 @@ vtkImageData * vtkProgrammableElectronicData::GetMO(vtkIdType orbitalNumber)
void vtkProgrammableElectronicData::SetMO(vtkIdType orbitalNumber,
vtkImageData *data)
{
if (orbitalNumber <= 0)
{
vtkErrorMacro("Cannot set invalid orbital number "<<orbitalNumber);
return;
}
if (orbitalNumber > static_cast<vtkIdType>(this->MOs->size()))
{
this->SetNumberOfMOs(orbitalNumber);
......
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