Code:
try {
SDL_SetColorKey(surfaces[folderCnt][surfacesCnt], SDL_TRUE, SDL_MapRGB(surfaces[folderCnt][surfacesCnt]->format, 255, 0, 255));
}
catch (int err) {
}
Error: Exception thrown at 0x00476F1E in game1.exe: 0xC0000005: Access violation reading location 0x00000004.
When surfacesCnt = 10 it throws the error. That is because there is no surface 10. I know that and I want to catch the exception and process the next surface (surfacesCnt = 11).
Why are the try catch statements not catching the error? This would work perfectly in Python and Pascal.
User contributions licensed under CC BY-SA 3.0