Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xosc.ParseOpenScenario expects optional Event/startTrigger #182

Open
zwergziege opened this issue Sep 21, 2023 · 6 comments
Open

xosc.ParseOpenScenario expects optional Event/startTrigger #182

zwergziege opened this issue Sep 21, 2023 · 6 comments

Comments

@zwergziege
Copy link

zwergziege commented Sep 21, 2023

In OpenScenario V1.2 Event/startTrigger is optional and set to the start condition of the enclosing Act if missing. The current implementation of xosc.ParseOpenScenario fails if this child element is missing.
Edit: corrected wrong child name

@mander76
Copy link
Collaborator

Could you provide an example?

The only optional is the ConditionGroup when it comes to triggers, not Conditions.
However there is an issue that you cannot have an trigger without conditionsgroups, when creating the xosc, that I'll fix.

@zwergziege
Copy link
Author

I'm talking about Event not Trigger, but I specified the wrong child. It's actually Event/startTrigger not Event/startCondition. I fixed it above.
According to the spec, the following is a valid event

<Event name="Event" priority="skip">
   <Action name="Action">
   </Action>
</Event>

However, parsing it should fail since Event.parse - lacking startTrigger - calls Trigger.parse(null) which throws.

@zwergziege zwergziege changed the title xosc.ParseOpenScenario expects optional Event/startCondition xosc.ParseOpenScenario expects optional Event/startTrigger Sep 22, 2023
@mander76
Copy link
Collaborator

Aha, now it's clearer. Thanks. I'll fix that.

@mander76
Copy link
Collaborator

@zwergziege
Copy link
Author

The change should not work since it still calls Trigger.parse(element.find("StartTrigger")) unconditionally, which fails if the event does not have a startTrigger. You should check whether the result of elementfind("StartTrigger") is not null and only then try to parse and append it to the event.

@mander76
Copy link
Collaborator

mander76 commented Nov 8, 2023

Sorry for the late update, now there is a new push in the same branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants