When I try to create an array of a structure I am getting a System.NullReferenceException exception in my program. I'm using Visual C++.Net
and the specific piece of code gets a count and attempts to allocate the array for the count. Am I missing something in the syntax of my allocation?
if(!pNode) return false;
xnl = pNode->ChildNodes;
if(!xnl) return false;
IEnumerator *ie = xnl->GetEnumerator();
_xmlTransaction[numTransactions]._payloads.numProperties = xnl->Count;
// THIS IS WHERE I GET THE ERROR
_xmlTransaction[numTransactions]._payloads._properties = new property[xnl->Count];
This is the structure for "property"
// property info
struct property
{
property_address _address; // the address for this property
property_inspection *_inspections; // a list of inspections
int numInspections; // the number of inspections
std::string property_type;
std::string units;
};
[Edited by - jon723 on January 10, 2006 2:04:28 PM]