fixed possible segfault when tileHeader.numTiles == 0

found this after messing about with creating smf files. i want to do more along these lines, making header.numTiles completely redundant.
unaware of std::min   I can fix it and resubmit?