summaryrefslogtreecommitdiff
path: root/src/gui/chatwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-06-14 23:59:44 +0300
committerAndrei Karas <akaras@inbox.ru>2011-06-14 23:59:44 +0300
commitbf235a610f10301471ca83ce153511d63b3fa9f9 (patch)
tree807def519ff2dd564cdb23a4c05cd9a79338eab2 /src/gui/chatwindow.cpp
parentbf9bccc30a186e338f96c230a4f63cc924c77bd8 (diff)
downloadplus-bf235a610f10301471ca83ce153511d63b3fa9f9.tar.gz
plus-bf235a610f10301471ca83ce153511d63b3fa9f9.tar.bz2
plus-bf235a610f10301471ca83ce153511d63b3fa9f9.tar.xz
plus-bf235a610f10301471ca83ce153511d63b3fa9f9.zip
Add missing checks.
Diffstat (limited to 'src/gui/chatwindow.cpp')
-rw-r--r--src/gui/chatwindow.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index a575b7054..1829a55ba 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -1304,12 +1304,15 @@ void ChatWindow::initTradeFilter()
if (!stat(tradeListName.c_str(), &statbuf) && S_ISREG(statbuf.st_mode))
{
tradeFile.open(tradeListName.c_str(), std::ios::in);
- char line[100];
- while (tradeFile.getline(line, 100))
+ if (tradeFile.is_open())
{
- std::string str = line;
- if (!str.empty())
- mTradeFilter.push_back(str);
+ char line[100];
+ while (tradeFile.getline(line, 100))
+ {
+ std::string str = line;
+ if (!str.empty())
+ mTradeFilter.push_back(str);
+ }
}
tradeFile.close();
}
@@ -1466,12 +1469,15 @@ void ChatWindow::loadCustomList()
if (!stat(listName.c_str(), &statbuf) && S_ISREG(statbuf.st_mode))
{
listFile.open(listName.c_str(), std::ios::in);
- char line[101];
- while (listFile.getline(line, 100))
+ if (listFile.is_open())
{
- std::string str = line;
- if (!str.empty())
- mCustomWords.push_back(str);
+ char line[101];
+ while (listFile.getline(line, 100))
+ {
+ std::string str = line;
+ if (!str.empty())
+ mCustomWords.push_back(str);
+ }
}
listFile.close();
}