mirror of
https://github.com/s-d-a/DCS-ExportScripts.git
synced 2025-10-29 16:59:03 +00:00
catch exceptions for nil value
This commit is contained in:
@@ -73,7 +73,8 @@ function ExportScript.Tools.ProcessInput()
|
|||||||
end
|
end
|
||||||
elseif lDevice == "1000" then
|
elseif lDevice == "1000" then
|
||||||
--ExportScript.genericRadio(key, value, hardware)
|
--ExportScript.genericRadio(key, value, hardware)
|
||||||
ExportScript.genericRadio(lCommandArgs[2],lCommandArgs[3], ExportScript.Config.genericRadioHardwareID)
|
--ExportScript.genericRadio(lCommandArgs[2],lCommandArgs[3], ExportScript.Config.genericRadioHardwareID)
|
||||||
|
ExportScript.genericRadio(lCommandArgs[2],lCommandArgs[3])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -140,6 +141,15 @@ end
|
|||||||
|
|
||||||
-- Network Functions for GlassCockpit
|
-- Network Functions for GlassCockpit
|
||||||
function ExportScript.Tools.SendData(id, value)
|
function ExportScript.Tools.SendData(id, value)
|
||||||
|
if id == nil then
|
||||||
|
ExportScript.Tools.WriteToLog("Export id is nil")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if value == nil then
|
||||||
|
ExportScript.Tools.WriteToLog("Value for id "..id.." is nil")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if string.len(value) > 3 and value == string.sub("-0.00000000",1, string.len(value)) then
|
if string.len(value) > 3 and value == string.sub("-0.00000000",1, string.len(value)) then
|
||||||
value = value:sub(2)
|
value = value:sub(2)
|
||||||
end
|
end
|
||||||
@@ -161,6 +171,14 @@ end
|
|||||||
-- Network Functions for DAC
|
-- Network Functions for DAC
|
||||||
function ExportScript.Tools.SendDataDAC(id, value)
|
function ExportScript.Tools.SendDataDAC(id, value)
|
||||||
for hardware=1, #ExportScript.Config.DAC, 1 do
|
for hardware=1, #ExportScript.Config.DAC, 1 do
|
||||||
|
if id == nil then
|
||||||
|
ExportScript.Tools.WriteToLog("Export id is nil")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if value == nil then
|
||||||
|
ExportScript.Tools.WriteToLog("Value for id "..id.." is nil")
|
||||||
|
return
|
||||||
|
end
|
||||||
if ExportScript.Config.DAC[hardware] == nil then
|
if ExportScript.Config.DAC[hardware] == nil then
|
||||||
ExportScript.Tools.WriteToLog("unknown hardware ID '"..hardware.."' for value: '"..id.."="..value.."'")
|
ExportScript.Tools.WriteToLog("unknown hardware ID '"..hardware.."' for value: '"..id.."="..value.."'")
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user