summaryrefslogtreecommitdiff
path: root/plugingui/resource.cc
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/resource.cc')
-rw-r--r--plugingui/resource.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/plugingui/resource.cc b/plugingui/resource.cc
index 7d1c5b0..2435668 100644
--- a/plugingui/resource.cc
+++ b/plugingui/resource.cc
@@ -42,6 +42,8 @@ static bool nameIsInternal(const std::string& name)
Resource::Resource(const std::string& name)
{
+ isValid = false;
+
if(nameIsInternal(name))
{
// Use internal resource:
@@ -78,7 +80,11 @@ Resource::Resource(const std::string& name)
}
// Get the file size
- std::fseek(fp, 0, SEEK_END);
+ if(std::fseek(fp, 0, SEEK_END) == -1)
+ {
+ std::fclose(fp);
+ return;
+ }
size_t filesize = ftell(fp);
// Reserve space in the string for the data.
@@ -97,7 +103,7 @@ Resource::Resource(const std::string& name)
std::fclose(fp);
isInternal = false;
- }
+ }
isValid = true;
}