From 49a19edf636c9b5aafe68a52445e767eb219c644 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 12 Apr 2014 22:54:26 +0000 Subject: [PATCH] Avoid selecting invalid tab when removing last page from wxOSX wxNotebook. Closes #15897 (backport of r75663 from trunk). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76319 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/cocoa/notebook.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/osx/cocoa/notebook.mm b/src/osx/cocoa/notebook.mm index d71ca4047c..2f8eceb426 100644 --- a/src/osx/cocoa/notebook.mm +++ b/src/osx/cocoa/notebook.mm @@ -194,7 +194,8 @@ public: // avoid 'changed' events when setting the tab programmatically wxTabViewController* controller = [slf delegate]; [slf setDelegate:nil]; - [slf selectTabViewItemAtIndex:(value-1)]; + if ( value > 0 ) + [slf selectTabViewItemAtIndex:(value-1)]; [slf setDelegate:controller]; }