如何修复:check_and_cast():无法将NULL指针强制转换为类型&#; IPv4ControlInfo *'

时间:2015-10-23 19:00:18

标签: routing omnet++ inet

这是我在AODVRouting.cc中实现的重放方法(已经在inet中)。当我启动模拟时,它会运行一段时间,但后来我收到了这个错误:

check_and_cast(): cannot cast NULL pointer to type 'IPv4ControlInfo *'

这是我的方法:

void AODVRouting::Replay (cMessage *msg)
{
        std::cout<<"Mal Host Activity"<<endl;
        EV <<"Mal Host Activity \n";
        this->bubble("Replaying...");
        this->host->setDisplayString("i=misc/node,red");

            cMessage *ReplayMsg = msg->dup();
            std::cout<<"Done Duplicating MSG"<<endl;
            EV<<"Done Duplicating MSG \n";


            //we can add a delay before sending the copy of the message again (10 time units)
            //scheduleAt(simTime() + 1, ReplayMsg);
            send(ReplayMsg, "ipOut");
            //sendDelayed(ReplayMsg, 0.01,"ipOut");

            std::cout<<"Launched Replayed Packet!\n";
            EV<<"Launched Replayed Packet!\n";
            this->bubble("Attack");
}

如何修复错误?

1 个答案:

答案 0 :(得分:0)

似乎ipv4address指向了一个空因子 - 数据包在到达我正在尝试的命令之前被销毁。 我通过引用索引而不是IP来找到修复: getIndex()