Fix potential nil post type