How can I resolve a cart error when no product is added?

I hope you all are doing well Can please someone guides me according to this code. Product will be added to the cart if you click on submit button but If someone does not add a product and click on submit it generates an error can you please guide me on how I will get rid of this error?

CODE:

After pressing submit button without product.

Hi @Hamzataj

Please try in Incognito mode or clear browser cookie, It helped me solve the problem before.

Thanks but I have added this condition in my code according to this if the cart is empty it will generate an error

OK but just let you know this form working well for me