dongju.jeong Posted December 3, 2021 Posted December 3, 2021 (edited) An error occurs when obtaining a node pointer. Nodeptr continues to be expressed as null. However, even if it is expressed as null, Nodeptr is used normally. (Do not cause a pointer error) The same phenomenon occurs when a pointer of another class is obtained as getcomponent<C>() method. in this instance, An instance of another class is expressed as nullptr, but the function of the class is used normally, and the variable does not change even if a input value to variable . [example] class foo: public ComponentBase { COMPONENT(foo, ComponentBase); PROP_NAME("foo"); COMPONENT_INIT(init); COMPONENT_UPDATE(update); protected: void init(); void update(); public: int value = 0; void method(); } //------------------------------------------------------------- <Some Class's Update()> SomeClass::Update() { foo* it = getComponent<foo>(someNode->findNode("foo_Node", 1)); // return nullptr, There is no problem with "someNode" used to obtain the foo class. it->method(); // did not occur error, and fuction work it->value = 3; // did not occur error, but vlaue not changed. } I'm not sure where the problem started. Edited December 3, 2021 by dongju.jeong
silent Posted December 7, 2021 Posted December 7, 2021 The "problem" is started in C++ itself :) You can call methods from nullptr and nothing will indicates that you are doing some terribly wrong things. More info you can check here: https://stackoverflow.com/questions/11320822/why-does-calling-method-through-null-pointer-work-in-c https://stackoverflow.com/questions/49872721/why-calling-function-with-nullptr-does-not-crash-my-application/49873215 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Recommended Posts