I had problems dealing with this exception: try/catch Statement | Example Depot
Go here and read up on it.

tl/dr use a try/catch statement