Fix crash when there is no error code