aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Cache.cpp1
-rw-r--r--src/Gif.cpp21
2 files changed, 19 insertions, 3 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp
index a4c740f..fe377e8 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -138,7 +138,6 @@ namespace dchat
catch(std::exception &e)
{
fprintf(stderr, "Failed to load image %s, reason: %s\n", filepath.string().c_str(), e.what());
- delete fileContent.data;
}
return { (sf::Texture*)nullptr, ImageByUrlResult::Type::FAILED_DOWNLOAD };
}
diff --git a/src/Gif.cpp b/src/Gif.cpp
index 6b38f10..7a80f86 100644
--- a/src/Gif.cpp
+++ b/src/Gif.cpp
@@ -66,7 +66,16 @@ namespace dchat
{
throw GifLoadException(e.what());
}
- init();
+
+ try
+ {
+ init();
+ }
+ catch(GifLoadException &e)
+ {
+ delete fileContent.data;
+ throw e;
+ }
}
Gif::Gif(StringView &&_fileContent) :
@@ -74,7 +83,15 @@ namespace dchat
currentFrame(0),
timeElapsedCs(0.0)
{
- init();
+ try
+ {
+ init();
+ }
+ catch(GifLoadException &e)
+ {
+ delete fileContent.data;
+ throw e;
+ }
}
void Gif::init()