Just a safety check in thin3d texture loading

This commit is contained in:
Henrik Rydgard committed 2015-11-27 00:17:14 +01:00
1 parent 5827b583d3
commit efde6e44db
1 file changed
+5
+5
View File
@@ -207,6 +207,11 @@ bool Thin3DTexture::LoadFromFileData(const uint8_t *data, size_t dataSize, T3DIm
return false;
}
if (num_levels < 0 || num_levels >= 16) {
ELOG("Invalid num_levels: %d. Falling back to one. Image: %dx%d", num_levels, width, height);
num_levels = 1;
}
Create(LINEAR2D, fmt, width[0], height[0], 1, num_levels);
for (int i = 0; i < num_levels; i++) {
if (image[i]) {