Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Fix "Empty string supplied as input" bug #647

Merged
merged 5 commits into from Jun 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions class-instant-articles-post.php
Expand Up @@ -18,6 +18,8 @@
use Facebook\InstantArticles\Elements\Caption;
use Facebook\InstantArticles\Elements\Footer;
use Facebook\InstantArticles\Transformer\Transformer;
use Facebook\InstantArticles\Validators\Type;

/**
* Class responsible for constructing our content and preparing it for rendering
*
Expand Down Expand Up @@ -689,8 +691,11 @@ public function to_instant_article() {
Image::setDefaultCommentEnabled( $settings_publishing[ 'comments_on_media' ] );
Video::setDefaultCommentEnabled( $settings_publishing[ 'comments_on_media' ] );
}

$transformer->transformString( $this->instant_article, $this->get_the_content(), get_option( 'blog_charset' ) );

$the_content = $this->get_the_content();
if (!Type::isTextEmpty($the_content)) {
$transformer->transformString( $this->instant_article, $the_content, get_option( 'blog_charset' ) );
}

$this->add_ads_from_settings();
$this->add_analytics_from_settings();
Expand Down