Fix crash with empty tab