Do...while causing fatal crash

Do…While loop causing fatal crash and I’ve got no idea why, can anybody give any tips?

function randomValue(dir){
if(dir == “height”){
var randomInt = Math.round(random(game.number_tiles/5));
}else{
var randomInt = Math.round(random((game.number_tiles/5)+1));
}
return randomInt;
}

function checkLevelEmpty(){
var currentRandomX = randomValue(‘width’);
var currentRandomY = randomValue(‘height’);
trace('Random X: ‘+currentRandomX+’, Random Y: '+currentRandomY);

if(level[currentRandomY][currentRandomX] != 2){
        currentFilledTiles++;
        level[currentRandomY][currentRandomX] = 2;
}else{
        trace('Try Again!');
}

}

currentFilledTiles = 0;
// generate the random level array with misc placement
do {
checkLevelEmpty();
}
while (currentFilledTiles <= game.number_tiles);
}

It still causes a nasty crash, I checked it by showing the output in the this.onEnterFrame = function(){ trace(bla); } method.

It’s cycling through the random numbers and never exceeding 12, it needs to get to 15! but never does. I need some way to check through the ones already done, dump them in an Array and check that first maybe? I’m drawing a blank at the moment.

try to narrow it down as best you can so you have the minimal code needed to reliably produce a crash.

Flash Player should never crash. If it does, it’s a bug and needs to be fixed.