The leave handler checks for NULL surfaces, but the enter handler does not.
leave
enter
Fixes: #17 (closed)
This will create a new commit in order to revert the existing changes.