Only highlight Flagged sidebar if actions are available

As the subject says, I was wondering if there was a way for the Flagged sidebar to only be highlighted incase there are any available actions. Otherwise, it leads to the absurd situation where I click on the flagged sidebar, only to find nothing there.

I have included an example screenshot.