Check if there is a value before trying to do any operation