Add a null check for postDetails.