I'm trying to access a handle to a ::Collections::ArrayList with a two simple accessor/mutator functions:
/** --------------------------------------------
* public accessor for RX message queue
* --------------------------------------------- */
System::Collections::ArrayList^ peak_lib::rx_queue(void)
{
return this->m_Queue_Mes_RX;
}
/** --------------------------------------------
* public mutator for RX message queue
* --------------------------------------------- */
void peak_lib::rx_queue( System::Collections::ArrayList^ inList )
{
if ( inList->Count != 0 ) // <-- error line
{
this->m_Queue_Mes_RX = inList;
}
}
My compiler throws An unhandled exception of type 'System.NullReferenceException' occurred in my.exe
and adds that the reference was not called on an object ( or something along these lines, I have to translate it from polish :/ ) when I try to access the ->Count
property ( see error line in code ) as somebody told me to here to check if the inList variable exists.
What's the right (or at least a better :D) way to check if an ArrayList
exists when I'm using C++/CLI Visual Studio 2008?