Hi all,
so my program produced a crash and I ran the debugger. The crash occurs in the following code segment:
void RFormulaData::setSpecies(int nr, const RFormSpecies& sp0)
{
if ((nr < 0) || (nr > 5)) return;
sp[nr] = sp0; // line with the crash
}
void RFormulaData::setSpecies(int nr, const RFormSpecies& sp0)
{
if ((nr < 0) || (nr > 5)) return;
sp[nr] = sp0; // line with the crash
}
To copy to clipboard, switch view to plain text mode
The debugger shows the watches seen in the attached screenshot. And this is what confuses me. Apparently the this pointer whose function has already been called is NULL. I've never seen this before. I thought I would get a crash if I tried to call a function from any object pointer that is NULL and never make it into that function.
The data itself is pretty harmless, I think. 'sp' is just a statically allocated array of type RFormSpecies and size 6.
Can someone explain how I can be inside the function of a null object, or direct me to an explanation, and give me hint how to solve this problem ?
Thank you !
Bookmarks