I just ran into the same problem as gudal on creating an enormous map. I tried changing line 5487 as you suggested and I'm still getting the same crash. There seems to be an issue with getting a valid startingPlot. If I comment out 5487, it'll fail at 5491. Removing Kupe from the list of civs did avoid the problem.