From a84dc7543a6cbf8ce625aa416673161072722e43 Mon Sep 17 00:00:00 2001 From: Jessica Hamilton Date: Sun, 30 Aug 2015 12:58:16 +1200 Subject: [PATCH] BAlert: move setting default button into AddButton(). This properly fixes the crash in #12271, introduced by hrev49481. --- src/kits/interface/Alert.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/kits/interface/Alert.cpp b/src/kits/interface/Alert.cpp index ad370d2654..0140f84fcb 100644 --- a/src/kits/interface/Alert.cpp +++ b/src/kits/interface/Alert.cpp @@ -377,6 +377,7 @@ BAlert::AddButton(const char* label, char key) fButtons.push_back(button); fKeys.push_back(key); + SetDefaultButton(button); fButtonLayout->AddView(button); } @@ -643,8 +644,6 @@ BAlert::_Prepare() if (CountButtons() == 0) debugger("BAlerts must have at least one button."); - SetDefaultButton(ButtonAt(CountButtons() - 1)); - float fontFactor = be_plain_font->Size() / 11.0f; if (fIconView->Bitmap() == NULL)