diff --git a/src/WallpaperEngine/Assets/CVirtualContainer.cpp b/src/WallpaperEngine/Assets/CVirtualContainer.cpp index c68ce32..d244e95 100644 --- a/src/WallpaperEngine/Assets/CVirtualContainer.cpp +++ b/src/WallpaperEngine/Assets/CVirtualContainer.cpp @@ -10,10 +10,10 @@ void CVirtualContainer::add (const std::filesystem::path& filename, const std::s } void CVirtualContainer::add (const std::filesystem::path& filename, const std::string& contents) { - size_t length = contents.length () + 1; + // do not copy the null terminator + size_t length = contents.length (); std::shared_ptr copy = std::shared_ptr (new uint8_t [length]); - // copy the text AND the \0 memcpy (copy.get(), contents.c_str (), length); // finally add to the container diff --git a/src/WallpaperEngine/Data/Parsers/MaterialParser.cpp b/src/WallpaperEngine/Data/Parsers/MaterialParser.cpp index ab9e5ea..9714c73 100644 --- a/src/WallpaperEngine/Data/Parsers/MaterialParser.cpp +++ b/src/WallpaperEngine/Data/Parsers/MaterialParser.cpp @@ -63,7 +63,12 @@ std::map MaterialParser::parseTextures (const JSON& it) { for (const auto& cur : it) { if (!cur.is_null ()) { - result.emplace (index, cur); + if (!cur.is_string ()) { + sLog.error ("Detected a non-string texture, most likely a special value: ", cur.dump ()); + result.emplace (index, ""); + } else { + result.emplace (index, cur); + } } index++;