Check whether record is None before trying to read its keys otherwise app crashes on GAE (and other memdb's)
Merge pull request #426 from ortgit/issue/1919

Check whether memdb record is None before trying to read its keys