GitHub-TC / EmpyrionScripting

Displays various informations directly and live on LCD screens and will support conveyor and construction control
GNU General Public License v3.0
34 stars 5 forks source link

{{E.S.Players.[0].DrivingEntity.Name}} does not work correctly #8

Closed drabont7 closed 2 years ago

drabont7 commented 2 years ago

Describe the bug {{E.S.Players.[0].DrivingEntity.Name}} An attempt to access any field of an empty DrivingEntity object results in an error. An attempt to handle the error using the helpers: "if" and "ok" fails.

To Reproduce lcd script, tested in single and server

Expected behavior Reading a value must return a value or void which can be checked using helpers.

GitHub-TC commented 2 years ago

Here you have to check DrivingEntity for not 'null' (with "ok" or "if" ) before you want to access further data.

drabont7 commented 2 years ago

Here you have to check DrivingEntity for not 'null' (with "ok" or "if" ) before you want to access further data.

code: {{#test E.S.Players.length 'ge' 0}} {{#if E.S.Players.[0].DrivingEntity}} {{E.S.Players.[0].DrivingEntity.Name}} {{/if}} {{/test}}

show an error: "{test} [1 ge 0 ]:Exception has been thrown by the target of an invocation. 13:23:50"

Empyrion 1.8.3 3849 04-10:26, SP, EmpyrionScripting by ASTIC/TC Version:11.0.0.0,