fix crash when invalid tab index for badge