WebDevStudios / Automatic-Featured-Images-from-Videos

If a YouTube or Vimeo video exists in the first few paragraphs of a post, automatically set the post's featured image to that vidoe's thumbnail.
33 stars 24 forks source link

Entering a bogus video URL results in a fatal error #43

Closed kellenmace closed 7 years ago

kellenmace commented 7 years ago

If a user enters a bogus URL, like https://youtu.be/asdf, there isn't a check in place to determine whether sideloading was successful before calling set_post_thumbnail() to attempt to set the post thumbnail. Currently, if the URL 404s, wds_set_video_thumbnail_as_featured_image() returns a WP_Error object which is then passed to set_post_thumbnail(), which causes a fatal error.