Is it a bad idea to buy a car that has been discontinued?

I’m looking at the Toyota C-HR and I really like the look of this car but in my research, I found that this is the last year that Toyota will make them. Is it a bad idea to buy a car that has been discontinued?