added check to see if curr is still valid.

Emacs temp files can cause curr to be null during the check. This just adds an extra check before assuming it exists.