Possibly more performant fix. Doesn't require LUA to parse the entire list of Item Prototypes. Lets the engine do that and provide a much shorter list.
local get_fuel_items = function(player)
local fuel_items = {}
local chemical_fuel = prototypes.get_item_filtered({{filter = "fuel-value", comparison = ">", value = 0}, {filter = "fuel-category", ["fuel-category"] = "chemical", mode = "and"}})
for k, item in pairs(chemical_fuel) do
table.insert(fuel_items, { name = item.name, count = 1, fuel_top_speed_multiplier = item.fuel_top_speed_multiplier })
end
local use_best_fuel_first = settings.get_player_settings(player)["set-fuel-preference"].value