I’m downloading image file from the internet and using this file to create new texture with addImage function.
CCTexture2D *newTexture = CCTextureCache::sharedTextureCache()->addImage(sFileName.c_str());
But sometimes file is not valid image (e.g. text or html). In that case addImage causes crash. Try-catch block does not help. So, my question is:
- Is there any way to check if file is valid image?
Thanks in advance!