Fix a "creating default object from empty value" notice on failed parsing.

Silly oversight. Given invalid input, fromJSON() can fail and return NULL.
This commit is contained in:
Yahnis Elsts 2016-01-09 18:07:51 +02:00
parent 7a29fda377
commit 6999915d36
1 changed files with 4 additions and 2 deletions

View File

@ -264,8 +264,10 @@ class PluginUpdateChecker_2_3 {
$pluginInfo = null;
if ( !is_wp_error($status) ){
$pluginInfo = PluginInfo_2_3::fromJson($result['body']);
$pluginInfo->filename = $this->pluginFile;
$pluginInfo->slug = $this->slug;
if ( $pluginInfo !== null ) {
$pluginInfo->filename = $this->pluginFile;
$pluginInfo->slug = $this->slug;
}
} else if ( $this->debugMode ) {
$this->triggerError(
sprintf('The URL %s does not point to a valid plugin metadata file. ', $url)