Handle undefined theme the right way

Sorry for the confusion.
This is the right way to do #10236.
I wonder if `currentTheme` should never be undefined. Since we have two default themes, I wouldn't necessarily expect this behavior. I assume that I'm missing an important detail, but it's not fully clear to me.