Do you know the assert-macro? It is an easy tool for debugging: You can use it to check if a pointer is a NULL-pointer or if your application is in a proper state for processing. When this is not the case, if will stop your application, when you are using a debug mode, in release…