Added a null check for the post object in savePost(), just in case.