Array variable from message turns unusable?

12 views
Skip to first unread message

alanxptm

unread,
Jun 22, 2022, 12:44:27 AM6/22/22
to OMNeT++ Users
I have a message.msg like this:

int sn;
string node[];

When I create the message I set the size and iterate through a loop to fill the node array with:

msg.setNodeArraySize(value);
loop starts
          msg.setNode(position, string);
loop ends

Later when the message its received in another node, the message get its variables read in several methods. In the first ones I get the size like:

int size = msg.getNodeArraySize();

But I've a method later that doing the exact same thing, the simulation crashes with:

Exception code=0xc0000005 flags=0x0 at 0x00007FF6C475925A. Access violation - attempting to read data at address 0xFFFFFFFFFFFFFFFC
Simulation terminated with exit code: c0000005

If I use the variable as a conditional it just ignores the condition and crashes when try to use the array, also crashes if I try to print the size or any value with EV.

I have been trying to solve this, priting the value in each method and always seems to work until not. The method in question receives the message and access other variables normally, but is this one that stops working.
Reply all
Reply to author
Forward
0 new messages