If number of platforms is 20 and you are looping over i<=NumberOfPlatforms then the last element is 21st out of 20, because you are looping over 0, 1, ..., 20 and that's 21 elements. So it's likely out of bounds as already mentioned.
The "NumberOfPlatforms" int starts out as 0, than (with the function of code block 4) the number is increased.
Also, not rendering still makes the game crash.
Also, have you ever used a debugger? It allows you to step through your code while the program is running, so you can see when and why it's crashing.
I have not, but setting breakpoints doesn't seem to work for me, when debugging the app closes instantly. (Visual Studio 2010 Express)