Fixed a null check in editPost method