Fix when user is null

This commit is contained in:
Thomas 2019-08-11 11:50:23 +02:00
parent e72715f1ab
commit 829391e1a3

View file

@ -39,7 +39,7 @@ class ComposeType extends AbstractType {
/**@var $user \App\SocialEntity\MastodonAccount**/
$user = $options['user'];
if( $user->getDefaultSensitivity()) {
if( $user && $user->getDefaultSensitivity()) {
$checkbox = [
'required' => false,
'attr' => ['checked' => 'checked'],
@ -58,7 +58,7 @@ class ComposeType extends AbstractType {
'status.visibility.private' => 'private',
'status.visibility.direct' => 'direct',
],
'data' => $user->getDefaultVisibility(),
'data' => $user?$user->getDefaultVisibility():'public',
]);
$builder->add('timeZone', TimezoneType::class);
$builder->add('sensitive', CheckboxType::class, $checkbox);