Need (If sidebar is emply = hide popup) Condition

Hi bricks team,
I’m using a sidebar to show image in popup so if the sidebar has no image, the popup should hide from entire site.

Is it currently possible? if possible please guide me how can i do it.

Thanks.