From 551e9f611c391e3df4e7635a624336586a39fdfc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 6 May 2013 21:27:07 +0300 Subject: improve buyselldialog class. --- src/gui/buyselldialog.cpp | 10 ++++++---- src/gui/buyselldialog.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/gui/buyselldialog.cpp b/src/gui/buyselldialog.cpp index 32e762c1d..1c8c81b52 100644 --- a/src/gui/buyselldialog.cpp +++ b/src/gui/buyselldialog.cpp @@ -45,7 +45,7 @@ BuySellDialog::BuySellDialog(const int npcId) : init(); } -BuySellDialog::BuySellDialog(std::string nick) : +BuySellDialog::BuySellDialog(const std::string &nick) : // TRANSLATORS: shop window name Window(_("Shop"), false, nullptr, "buysell.xml"), gcn::ActionListener(), @@ -84,9 +84,11 @@ void BuySellDialog::init() add(btn); x += btn->getWidth() + buttonPadding; } - mBuyButton->requestFocus(); - - setContentSize(x, 2 * y + mBuyButton->getHeight()); + if (mBuyButton) + { + mBuyButton->requestFocus(); + setContentSize(x, 2 * y + mBuyButton->getHeight()); + } center(); setDefaultSize(); diff --git a/src/gui/buyselldialog.h b/src/gui/buyselldialog.h index ef3a98f18..391d90793 100644 --- a/src/gui/buyselldialog.h +++ b/src/gui/buyselldialog.h @@ -45,7 +45,7 @@ class BuySellDialog final : public Window, public gcn::ActionListener */ explicit BuySellDialog(const int npcId); - explicit BuySellDialog(std::string nick); + explicit BuySellDialog(const std::string &nick); A_DELETE_COPY(BuySellDialog) -- cgit v1.2.3-70-g09d2