techtanic / Discounted-Udemy-Course-Enroller

A script/software for automatically enrolling/joining 100% discounted Udemy courses for free. Get Paid Udemy courses for free with just a few clicks.
https://duce.techtanic.space
MIT License
820 stars 237 forks source link

Fixed IndexError in Error handling by checking list length in base.py and gui.py #169

Closed Gabrieliam42 closed 2 months ago

Gabrieliam42 commented 3 months ago

Fixed IndexError in Error handling by checking list length in base.py and gui.py

Gabrieliam42 commented 3 months ago

gui.py

Original Code Block:

elif event == "Error": msg = values["Error"].split("|:|") e = msg[0] title = msg[1] sg.popup_scrolled(e, title=title)

Updated Code Block: Replaced the above block with the following:

elif event == "Error": msg = values["Error"].split("|:|") e = msg[0] title = msg[1] if len(msg) > 1 else "Error" # Default title if msg[1] doesn't exist sg.popup_scrolled(e, title=title)

base.py

Original Code Block:

instructors = [ i["absolute_url"].split("/")[-2] for i in dma["serverSideProps"]["course"]["instructors"]["instructors_info"] ]

Updated Code Block: Replaced the above block with the following:

instructors = [ i["absolute_url"].split("/")[-2] for i in dma["serverSideProps"]["course"]["instructors"]["instructors_info"] if len(i["absolute_url"].split("/")) > 1 # Ensure there are enough elements ]