diff --git a/WickedEngine/Utility/dds.h b/WickedEngine/Utility/dds.h index e69e03ea8..416c13b43 100644 --- a/WickedEngine/Utility/dds.h +++ b/WickedEngine/Utility/dds.h @@ -331,16 +331,12 @@ namespace dds // returns the width of the texture in pixels constexpr unsigned width() const { - if (header.dwFlags & DDSD_WIDTH) - return header.dwWidth; - return 1; + return header.dwWidth < 1 ? 1 : header.dwWidth; } // returns the height of the texture in pixels constexpr unsigned height() const { - if (header.dwFlags & DDSD_HEIGHT) - return header.dwHeight; - return 1; + return header.dwHeight < 1 ? 1 : header.dwHeight; } // returns the depth of the texture in pixels constexpr unsigned depth() const diff --git a/WickedEngine/wiResourceManager.cpp b/WickedEngine/wiResourceManager.cpp index 9c9bde873..b07c59e7f 100644 --- a/WickedEngine/wiResourceManager.cpp +++ b/WickedEngine/wiResourceManager.cpp @@ -315,7 +315,7 @@ namespace wi resource->container_filesize = filesize; resource->container_fileoffset = container_fileoffset; - if (resource->filedata.empty() && (has_flag(flags, Flags::IMPORT_RETAIN_FILEDATA) || has_flag(flags, Flags::IMPORT_DELAY))) + if (filedata != nullptr && resource->filedata.empty() && (has_flag(flags, Flags::IMPORT_RETAIN_FILEDATA) || has_flag(flags, Flags::IMPORT_DELAY))) { // resource was loaded with external filedata, and we want to retain filedata // this must also happen when using IMPORT_DELAY!