TypeError: Cannot call method 'pop' of null

This would prevent the error.  The value will be undefined.  Or we could wrap it around a try/catch