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

[BUG] TcoControlledZone input variable nullpointer check #149

Open
KrisztianOlah opened this issue Aug 30, 2024 · 0 comments
Open

[BUG] TcoControlledZone input variable nullpointer check #149

KrisztianOlah opened this issue Aug 30, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@KrisztianOlah
Copy link
Contributor

KrisztianOlah commented Aug 30, 2024

Describe the bug
inDoorCircuit is passed as a pointer to interface therefore a check is needed before using the underlying object, otherwise dereferencing the nullobject will cause PLC to crash, which is annoying and harder to find.

To Reproduce
Set up an object with valid CUs, control buttons and keys (all of which get checked for null!) But "Forget" to set Door circuit.

Expected behavior
Messenger reporting programming error and PLC not crashing.

Additional context
The use of input variables for Air pressure and Estop active will make it hard to report to application developer that these are not set explicitly without them having to examine the source.

Also, may I suggest to replace this:

IF _controlButtons[0] = 0 OR _controlKeyMode[0] = 0 OR _controlKeyNormalService[0] = 0 THEN THIS^.Messenger.Programming('<#Missing link to control panel components (Buttons, Mode Keys, Normal/Service)! No function is being executed!#>'); RETURN; END_IF

with this:

Messenger.OnCondition(_controlButtons[0] = 0).Programming('<#Missing link to control buttons!#>'); Messenger.OnCondition(_controlKeyMode[0] = 0).Programming('<#Missing link to Mode key!#>'); Messenger.OnCondition(_controlKeyNormalService[0] = 0).Programming('<#Missing link to Normal/Service key!#>');

As the RETURN here is not necessary as it is checked prompty before use everywhere in the code. Furthermore, a more refined message will aid the application programmer in pinpointing the issue quicker.

@KrisztianOlah KrisztianOlah added the bug Something isn't working label Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants