Only try to regex match a youtube url if we actually have a search string

(youtube.py)
This commit is contained in:
jesopo 2019-01-11 12:03:23 +00:00
parent 59094568e0
commit e5a5241615

View file

@ -90,9 +90,10 @@ class Module(ModuleManager.BaseModule):
if last_youtube: if last_youtube:
search = last_youtube.message search = last_youtube.message
url_match = re.search(REGEX_YOUTUBE, search) if search:
if search and url_match: url_match = re.search(REGEX_YOUTUBE, search)
video_id = url_match.group(1) if url_match:
video_id = url_match.group(1)
if search or video_id: if search or video_id:
safe_setting = event["target"].get_setting("youtube-safesearch", safe_setting = event["target"].get_setting("youtube-safesearch",