Nill value when vehicle is missing on vehicle list

Fixed error "attempt to index a nil value (local 'firstVehicleData')" when vehicle doesn't exist on vehicle list/database.
This commit is contained in:
João Pedro Correia
2020-11-16 19:05:34 +00:00
committed by GitHub
parent e4a083e2d7
commit f510277ba0
+14 -12
View File
@@ -705,20 +705,22 @@ AddEventHandler('esx_vehicleshop:hasEnteredMarker', function(zone)
end
end
resellPrice = ESX.Math.Round(vehicleData.price / 100 * Config.ResellPercentage)
model = GetEntityModel(vehicle)
plate = ESX.Math.Trim(GetVehicleNumberPlateText(vehicle))
if vehicleData then
resellPrice = ESX.Math.Round(vehicleData.price / 100 * Config.ResellPercentage)
model = GetEntityModel(vehicle)
plate = ESX.Math.Trim(GetVehicleNumberPlateText(vehicle))
CurrentAction = 'resell_vehicle'
CurrentActionMsg = _U('sell_menu', vehicleData.name, ESX.Math.GroupDigits(resellPrice))
CurrentAction = 'resell_vehicle'
CurrentActionMsg = _U('sell_menu', vehicleData.name, ESX.Math.GroupDigits(resellPrice))
CurrentActionData = {
vehicle = vehicle,
label = vehicleData.name,
price = resellPrice,
model = model,
plate = plate
}
CurrentActionData = {
vehicle = vehicle,
label = vehicleData.name,
price = resellPrice,
model = model,
plate = plate
}
end
end
end