Catching an error where values var can be nil