small fix to sprite loading

This commit is contained in:
Henrique 2011-11-30 17:26:42 -02:00
parent 32c916ee68
commit 1185dc9a00
1 changed files with 3 additions and 0 deletions

View File

@ -83,6 +83,9 @@ TexturePtr SpriteManager::loadSpriteTexture(int id)
m_fin.read((char*)&transparentPixels, 2);
m_fin.read((char*)&coloredPixels, 2);
if(writePos + transparentPixels*4 + coloredPixels*3 >= 4096)
return g_graphics.getEmptyTexture();
for(int i = 0; i < transparentPixels; i++) {
pixels[writePos + 0] = 0x00;
pixels[writePos + 1] = 0x00;