ARTICLE AD BOX
This cannot happen if you are calling the method directly on a valid object instance. A valid object simply cannot reside at address 0x0, whether it is created in automatic memory or dynamic memory.
This CAN happen (but is not guaranteed to happen) if you call the method through a nullptr pointer to the object itself:
MyClass *ptrToClassInstance = nullptr; bool value = ptrToClassInstance->MyMethod();Or indirectly through a nullptr pointer to a containing class, where MyClass is the 1st data member (ie: offset 0 added to address 0x0 is still 0x0):
class OtherClass { MyClass classInstance; ... }; OtherClass *ptrToOtherClass = nullptr; bool value = ptrToOtherClass->classInstance.MyMethod();Either condition is undefined behavior. But, when the error does happen, you should analyze the call stack to determine where in your code the method is actually being called from, and then debug that code to determine if a bad pointer may be involved in the call.
