[RFC] fix #1027: :wundo segfault in new, non-empty buffer

@stefan991  I'll definitely change the name, but AFAICT checking for NULL is not sufficient because the file may also be invalid for whatever other reasons `os_getperm` might return negative on line 1036. According to its docstring this could only happen if the file path doesn't exist; that could happen if the file is deleted without Vim's knowledge. Let me know if I'm mistaken.