Check if console.warn is defined before calling it

Added checks to make sure console.warn is defined before calling it.