summaryrefslogtreecommitdiff
path: root/src/gui/windows/maileditwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-07-21 00:47:44 +0300
committerAndrei Karas <akaras@inbox.ru>2015-07-21 00:47:44 +0300
commitfffbd86a1014ad169ed2d68ea58cdddf346faa14 (patch)
tree713c96fcf7421ca87f638d312e752179281cb8fe /src/gui/windows/maileditwindow.cpp
parent1941b81a5a278f26a5d7e1f91903ab04c92e2cd1 (diff)
downloadmv-fffbd86a1014ad169ed2d68ea58cdddf346faa14.tar.gz
mv-fffbd86a1014ad169ed2d68ea58cdddf346faa14.tar.bz2
mv-fffbd86a1014ad169ed2d68ea58cdddf346faa14.tar.xz
mv-fffbd86a1014ad169ed2d68ea58cdddf346faa14.zip
Add missing checks and non null attributes.
Diffstat (limited to 'src/gui/windows/maileditwindow.cpp')
-rw-r--r--src/gui/windows/maileditwindow.cpp11
1 files changed, 7 insertions, 4 deletions
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());
+ }
}
}