From fffbd86a1014ad169ed2d68ea58cdddf346faa14 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 21 Jul 2015 00:47:44 +0300 Subject: Add missing checks and non null attributes. --- src/gui/windows/maileditwindow.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/gui/windows/maileditwindow.cpp') diff --git a/src/gui/windows/maileditwindow.cpp b/src/gui/windows/maileditwindow.cpp index 12ab097c0..1699b979c 100644 --- a/src/gui/windows/maileditwindow.cpp +++ b/src/gui/windows/maileditwindow.cpp @@ -136,11 +136,14 @@ void MailEditWindow::action(const ActionEvent &event) if (tempItem) { const Inventory *const inv = PlayerInfo::getInventory(); - const Item *const item = inv->findItem(tempItem->getId(), 1); - if (item) + if (inv) { - mailHandler->setAttach(item->getInvIndex(), - tempItem->getQuantity()); + const Item *const item = inv->findItem(tempItem->getId(), 1); + if (item) + { + mailHandler->setAttach(item->getInvIndex(), + tempItem->getQuantity()); + } } } -- cgit v1.2.3-70-g09d2