Ticket #2779: 2779.diff

File 2779.diff, 1.8 KB (added by Andrew, 10 years ago)
  • binaries/data/mods/public/gui/gamesetup/gamesetup.js

     
    382382        var civ = Engine.GetGUIObjectByName("playerCiv["+i+"]");
    383383        civ.onSelectionChange = function()
    384384        {   // Update civ
    385             if ((this.selected != -1)&&(g_GameAttributes.mapType !== "scenario"))
     385            if ((this.selected != -1)&&(g_GameAttributes.mapType !== "scenario")&&(this.list_data[this.selected] !== undefined))
    386386                g_GameAttributes.settings.PlayerData[playerSlot].Civ = this.list_data[this.selected];
    387387
    388388            if (!g_IsInGuiUpdate)
     
    10291029        var mapSelectionBox = Engine.GetGUIObjectByName("mapSelection");
    10301030        mapSelectionBox.selected = mapSelectionBox.list_data.indexOf(mapName);
    10311031        Engine.GetGUIObjectByName("mapSelectionText").caption = translate(getMapDisplayName(mapName));
    1032         var populationCapBox = Engine.GetGUIObjectByName("populationCap");
    1033         populationCapBox.selected = populationCapBox.list_data.indexOf(mapSettings.PopulationCap);
    1034         var startingResourcesBox = Engine.GetGUIObjectByName("startingResources");
    1035         startingResourcesBox.selected = startingResourcesBox.list_data.indexOf(mapSettings.StartingResources);
     1032       
     1033        if (mapSettings.PopulationCap !== undefined)
     1034        {
     1035            var populationCapBox = Engine.GetGUIObjectByName("populationCap");
     1036            populationCapBox.selected = populationCapBox.list_data.indexOf(mapSettings.PopulationCap);
     1037        }
     1038       
     1039        if (mapSettings.StartingResources !== undefined)
     1040        {
     1041            var startingResourcesBox = Engine.GetGUIObjectByName("startingResources");
     1042            startingResourcesBox.selected = startingResourcesBox.list_data.indexOf(mapSettings.StartingResources);
     1043        }
     1044
    10361045        initMapNameList();
    10371046    }
    10381047