fix bug yii\base\ErrorException: Trying to get property of non-object

in humhub/modules/stream/actions/Stream.php:308
This commit is contained in:
githubjeka 2017-07-26 14:40:12 +03:00
parent 40ecf23089
commit 167692a712

View File

@ -295,17 +295,26 @@ abstract class Stream extends Action
*/
public static function renderEntry(ContentActiveRecord $record, $options = [], $partial = true)
{
// TODO should be removed in next major version
// Compatibility with pre 1.2.2
if(is_bool($options)) {
$partial = $options;
$options = [];
}
$jsWidget = null;
if(isset($options['jsWidget'])) {
$jsWidget = $options['jsWidget'];
unset($options['jsWidget']);
} else {
$jsWidget = $record->getWallEntryWidget()->jsWidget;
if ($record->getWallEntryWidget() !== null) {
$jsWidget = $record->getWallEntryWidget()->jsWidget;
}
}
if ($jsWidget===null) {
return '';
}
if ($partial) {