Merge pull request #751 from MrPetovan/bug/twitter-fix-media_id_string-notice

[twitter] Fix Undefined property: stdClass::$media_id_string notice
This commit is contained in:
Tobias Diekershoff 2018-10-14 17:43:11 +02:00 committed by GitHub
commit fd3eb35c33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -591,7 +591,11 @@ function twitter_post_hook(App $a, array &$b)
unlink($tempfile);
$post['media_ids'] = $media->media_id_string;
if (isset($media->media_id_string)) {
$post['media_ids'] = $media->media_id_string;
} else {
throw new Exception('Failed upload of ' . $image);
}
} catch (Exception $e) {
logger('Exception when trying to send to Twitter: ' . $e->getMessage());