SA0145: Possible use of not initialised reference
Detects any reference variables that may not be initialized before use and are not checked by the operator __ISVALIDREF. This rule is applied in the implementation part of POUs. For the declaration, there is rule SA0124.
Justification: A reference should be checked for its validity before access because an access violation may occur during access.
Importance: High
Example 116. Example
PROGRAM PLC_PRG
VAR_INPUT
ref_iTest : REFERENCE TO INT;
END_VAR
ref_iTest := 99; // SA0145
IF __ISVALIDREF(ref_iTest) THEN
ref_iTest := 88;
END_IFOutput in the Messages view:
SA0145: Possible use of not initialised reference 'ref_iTest'