selsta / hlsdl

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

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

Closed theyashl closed 2 years ago

theyashl commented 2 years 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 2 years ago

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

theyashl commented 2 years ago

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