Check variable to prevent PHP notice