Skip to content

Commit

Permalink
Only proceed if we definitely have a valid post.
Browse files Browse the repository at this point in the history
  • Loading branch information
philipjohn authored and westonruter committed Feb 11, 2018
1 parent 4ced14c commit fc862f5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion includes/templates/class-amp-post-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ public function __construct( $post ) {
} else {
$this->post = get_post( $post );
}
$this->ID = $this->post->ID;

// Make sure we have a post, or bail if not.
if ( is_a( $this->post, 'WP_Post' ) ) {
$this->ID = $this->post->ID;
} else {
return;
}

$content_max_width = self::CONTENT_MAX_WIDTH;
if ( isset( $GLOBALS['content_width'] ) && $GLOBALS['content_width'] > 0 ) {
Expand Down

0 comments on commit fc862f5

Please sign in to comment.