prevent exceptions when metadata loading failed

This commit is contained in:
Laurent DEFERT 2022-12-28 19:06:07 +01:00
parent 5a4e6cee58
commit a7100a0f53
1 changed files with 2 additions and 2 deletions

View File

@ -866,7 +866,7 @@ class Media(models.Model):
# Otherwise, calculate from matched format codes
vformat = None
aformat = None
if '+' in format_str:
if format_str and '+' in format_str:
# Seperate audio and video streams
vformat_code, aformat_code = format_str.split('+')
vformat = self.get_format_by_code(vformat_code)
@ -875,7 +875,7 @@ class Media(models.Model):
# Combined stream or audio only
cformat = self.get_format_by_code(format_str)
aformat = cformat
if cformat['vcodec']:
if cformat and cformat['vcodec']:
# Combined
vformat = cformat
if vformat: