[Core] Check if there is a tab before activating it on DND.

Fixes #1247.