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/resources/db/emotedb.cpp | 2 ++ src/resources/db/horsedb.cpp | 2 ++ src/resources/image.cpp | 2 ++ 3 files changed, 6 insertions(+) (limited to 'src/resources') diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp index accea5ae9..eb5eef418 100644 --- a/src/resources/db/emotedb.cpp +++ b/src/resources/db/emotedb.cpp @@ -108,6 +108,8 @@ void EmoteDB::loadXmlFile(const std::string &fileName) currentInfo = mEmoteInfos[id]; else currentInfo = new EmoteInfo; + if (!currentInfo) + continue; currentInfo->time = XML::getProperty(emoteNode, "time", 500); currentInfo->effectId = XML::getProperty(emoteNode, "effect", -1); diff --git a/src/resources/db/horsedb.cpp b/src/resources/db/horsedb.cpp index 11fd57d36..a3daf76cc 100644 --- a/src/resources/db/horsedb.cpp +++ b/src/resources/db/horsedb.cpp @@ -97,6 +97,8 @@ void HorseDB::loadXmlFile(const std::string &fileName) else currentInfo = new HorseInfo; + if (!currentInfo) + continue; currentInfo->offsetX = XML::getProperty(horseNode, "offsetX", 0); currentInfo->offsetY = XML::getProperty(horseNode, "offsetY", 0); diff --git a/src/resources/image.cpp b/src/resources/image.cpp index cd615c030..fc1c5fa4f 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -305,6 +305,8 @@ void Image::setAlpha(const float alpha) else { mSDLSurface = SDLImageHelper::SDLDuplicateSurface(mSDLSurface); + if (!mSDLSurface) + return; } } -- cgit v1.2.3-70-g09d2