Same issue, I've seen it occur with certain types of locomotive (ex. SE Space Train) with Railway Motor Car.
Fixed it by going to %APPDATA%/Roaming/Factorio/mods
, unzipping ZElectricVehicles_1.2.1.zip
into the same folder (Factorio can run mods from an unzipped folder, and uses them preferentially over a zip of that mod in the same directory), then editing control.lua
.
Change line 75 from elseif not car.grid then
to elseif not car.grid or not car.burner then
. This adds a check to make sure the vehicle has a defined burner before trying to index it.
Also, if you have another mod (ex. Schall's Arachnid Platoon, Krastorio) that adds burners to spidertrons and want the electric vehicles to work on them without enabling the "Make Spidertron consume burnable fuel" setting, change line 30 from VEHICLE_TYPES = { "car", "locomotive" }
to VEHICLE_TYPES = { "car", "locomotive", "spider-vehicle" }
, to make the mod always consider spidertron-typed vehicles, even if the mod didn't personally add burners to them. With the above burner check, this is safe even if some spidertrons don't have burners.
Save the file, then load Factorio as normal.