Hydrogen vs. Battery Electric Cars

Can vehicles have solar panels in the roof and/or upward facing surface areas to mitigate or elongate range? It seems like a no brainer, but perhaps there are safety reason they haven't been installed yet.