selsta / hlsdl

C program to download VoD HLS (.m3u8) files
MIT License
630 stars 158 forks source link

Fixed the Segmentation fault error when non valid url is provided #125

Closed theyashl closed 1 year ago

theyashl commented 1 year ago

When a non valid is provided to hlsdl command line tool, Segmentation fault error is occurring.

Steps to reproduce:

hlsdl abcd

Output:

Error: No such file or directory
Error: abcd 404 tries[3]
Error: No such file or directory
Error: abcd 404 tries[2]
Error: No such file or directory
Error: abcd 404 tries[1]
{"error_code":404, "error_msg":""}
Segmentation fault (core dumped)

Fixed the code to handle the URL correctly and in result Segmentation fault is not occurring.

Output after fix:

Error: No such file or directory
Error: abcd 404 tries[3]
Error: No such file or directory
Error: abcd 404 tries[2]
Error: No such file or directory
Error: abcd 404 tries[1]
{"error_code":404, "error_msg":""}
selsta commented 1 year ago

Merged in dff8a5762f4a8a876f2d17da5300c771f8645b26, seems I messed something up and now the PR shows as closed instead of merged.

theyashl commented 1 year ago

No problem, @selsta , as the changes have been merged I am deleting the branch.