summaryrefslogtreecommitdiff
path: root/src/gui/windows/updaterwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-24 14:55:44 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-25 20:06:07 +0300
commit9d521a19be347703bfdbb7802d0397a59c3edd7a (patch)
tree9a4e56edc84d5cfd8ebaea17fa19296c51e1e661 /src/gui/windows/updaterwindow.cpp
parent841fe55e67ea467a8e2192dee5c169d282a35148 (diff)
downloadmanaplus-9d521a19be347703bfdbb7802d0397a59c3edd7a.tar.gz
manaplus-9d521a19be347703bfdbb7802d0397a59c3edd7a.tar.bz2
manaplus-9d521a19be347703bfdbb7802d0397a59c3edd7a.tar.xz
manaplus-9d521a19be347703bfdbb7802d0397a59c3edd7a.zip
Add missing checks in windows.
Diffstat (limited to 'src/gui/windows/updaterwindow.cpp')
-rw-r--r--src/gui/windows/updaterwindow.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 1ef2b7e2c..e221b73b9 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -541,6 +541,8 @@ size_t UpdaterWindow::memoryWrite(void *ptr, size_t size,
{
UpdaterWindow *const uw = reinterpret_cast<UpdaterWindow *>(stream);
const size_t totalMem = size * nmemb;
+ if (!uw)
+ return 0;
uw->mMemoryBuffer = static_cast<char*>(realloc(uw->mMemoryBuffer,
static_cast<size_t>(uw->mDownloadedBytes) + totalMem));
if (uw->mMemoryBuffer)
@@ -712,6 +714,8 @@ void UpdaterWindow::unloadUpdates(const std::string &dir)
void UpdaterWindow::loadManaPlusUpdates(const std::string &dir,
const ResourceManager *const resman)
{
+ if (!resman)
+ return;
std::string fixPath = dir + "/fix";
std::vector<UpdateFile> updateFiles = loadXMLFile(
std::string(fixPath).append("/").append(xmlUpdateFile), false);
@@ -737,6 +741,8 @@ void UpdaterWindow::loadManaPlusUpdates(const std::string &dir,
void UpdaterWindow::unloadManaPlusUpdates(const std::string &dir,
const ResourceManager *const resman)
{
+ if (!resman)
+ return;
const std::string fixPath = dir + "/fix";
const std::vector<UpdateFile> updateFiles = loadXMLFile(
std::string(fixPath).append("/").append(xmlUpdateFile), true);
@@ -762,6 +768,8 @@ void UpdaterWindow::addUpdateFile(const ResourceManager *const resman,
const std::string &restrict file,
const bool append)
{
+ if (!resman)
+ return;
const std::string tmpPath = std::string(path).append("/").append(file);
if (!append)
resman->addToSearchPath(tmpPath, append);
@@ -780,6 +788,8 @@ void UpdaterWindow::removeUpdateFile(const ResourceManager *const resman,
const std::string &restrict fixPath,
const std::string &restrict file)
{
+ if (!resman)
+ return;
resman->removeFromSearchPath(std::string(path).append("/").append(file));
const std::string fixFile = std::string(fixPath).append("/").append(file);
struct stat statbuf;
@@ -1070,6 +1080,8 @@ void UpdaterWindow::loadMods(const std::string &dir,
const ResourceManager *const resman,
const std::vector<UpdateFile> &updateFiles)
{
+ if (!resman)
+ return;
ModDB::load();
std::string modsString = serverConfig.getValue("mods", "");
std::set<std::string> modsList;