Implement the callback that warns the user on null ptr deref.
Add testcases.