Checking if post exists before accessing its properities

Currently if you view an non-existing thread e.g.
/wp-admin/post.php?post=25456&action=edit `$the_post` returns null causing
an error

So this commits check if it is null before continuing