Make sure we don't try to remove tabs when they don't exist (#5742)

This was an oversight.

Fixes #5738.
This commit is contained in:
Dustin L. Howett (MSFT) 2020-05-05 09:16:09 -07:00 committed by GitHub
parent 7d54bc5ecb
commit 046fed3d97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -828,9 +828,11 @@ namespace winrt::TerminalApp::implementation
void TerminalPage::_RemoveTabViewItem(const MUX::Controls::TabViewItem& tabViewItem)
{
uint32_t tabIndexFromControl = 0;
_tabView.TabItems().IndexOf(tabViewItem, tabIndexFromControl);
_RemoveTabViewItemByIndex(tabIndexFromControl);
if (_tabView.TabItems().IndexOf(tabViewItem, tabIndexFromControl))
{
// If IndexOf returns true, we've actually got an index
_RemoveTabViewItemByIndex(tabIndexFromControl);
}
}
// Method Description: