From 73bfd66285f1697abd3cffce4b12e09df814ecce Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 28 Jan 2019 19:34:06 +0100 Subject: Integrate clicky-kit with DOM to get click colours, image and image map from the drumkit xml. --- plugingui/resource.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'plugingui/resource.cc') 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; } -- cgit v1.2.3