check if the index is valid before accessing the list

fix #5272
avoid relaying invalid selection from the directory to the switchboard

This happens when activating on an invalid cell (no content)
Merge branch '5272-segfault-f5'