mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 12:12:00 -06:00
Fixed array length and nil panic
This commit is contained in:
parent
8544a49cab
commit
1b0124e385
2 changed files with 56 additions and 4 deletions
|
|
@ -152,11 +152,16 @@ func (e *Episode) GetFormat(resolution string, subtitle LOCALE, hardsub bool) (*
|
|||
var res *Format
|
||||
for _, format := range formats {
|
||||
if resolution == "worst" || resolution == "best" {
|
||||
curSplitRes := strings.SplitN(format.Video.Resolution, "x", 1)
|
||||
if res == nil {
|
||||
res = format
|
||||
continue
|
||||
}
|
||||
|
||||
curSplitRes := strings.SplitN(format.Video.Resolution, "x", 2)
|
||||
curResX, _ := strconv.Atoi(curSplitRes[0])
|
||||
curResY, _ := strconv.Atoi(curSplitRes[1])
|
||||
|
||||
resSplitRes := strings.SplitN(res.Video.Resolution, "x", 1)
|
||||
resSplitRes := strings.SplitN(res.Video.Resolution, "x", 2)
|
||||
resResX, _ := strconv.Atoi(resSplitRes[0])
|
||||
resResY, _ := strconv.Atoi(resSplitRes[1])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue