Co-Authored-By: idawnlight <idawn@live.com>
This avoids infinite loop when something went wrong and throws a error