瀏覽代碼

Merge pull request #1675 from rzhxeo/fix

Check if description and thumbnail are None to prevent crash
Philipp Hagemeister 12 年之前
父節點
當前提交
79b3f61228
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      youtube_dl/YoutubeDL.py

+ 2 - 2
youtube_dl/YoutubeDL.py

@@ -575,9 +575,9 @@ class YoutubeDL(object):
         if self.params.get('forceurl', False):
         if self.params.get('forceurl', False):
             # For RTMP URLs, also include the playpath
             # For RTMP URLs, also include the playpath
             compat_print(info_dict['url'] + info_dict.get('play_path', u''))
             compat_print(info_dict['url'] + info_dict.get('play_path', u''))
-        if self.params.get('forcethumbnail', False) and 'thumbnail' in info_dict:
+        if self.params.get('forcethumbnail', False) and info_dict.get('thumbnail') is not None:
             compat_print(info_dict['thumbnail'])
             compat_print(info_dict['thumbnail'])
-        if self.params.get('forcedescription', False) and 'description' in info_dict:
+        if self.params.get('forcedescription', False) and info_dict.get('description') is not None:
             compat_print(info_dict['description'])
             compat_print(info_dict['description'])
         if self.params.get('forcefilename', False) and filename is not None:
         if self.params.get('forcefilename', False) and filename is not None:
             compat_print(filename)
             compat_print(filename)