Index: src/wp-includes/comment.php
===================================================================
--- src/wp-includes/comment.php	(revision 35855)
+++ src/wp-includes/comment.php	(working copy)
@@ -1876,9 +1876,10 @@
 	do_action( 'wp_set_comment_status', $comment->comment_ID, $comment_status );

 	wp_transition_comment_status($comment_status, $comment_old->comment_approved, $comment);
-
-	wp_update_comment_count($comment->comment_post_ID);
-
+
+	if ( $comment->comment_post_ID ) {
+		wp_update_comment_count($comment->comment_post_ID);
+	}
 	return true;
 }

@@ -1947,7 +1948,9 @@
 	$rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) );

 	clean_comment_cache( $comment_ID );
-	wp_update_comment_count( $comment_post_ID );
+	if ( $comment_post_ID ) {
+		wp_update_comment_count( $comment_post_ID );
+	}
 	/**
 	 * Fires immediately after a comment is updated in the database.
 	 *
