SA0145: Possible use of not initialised referencePermalink

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. Rule SA0124 applies to the declaration.

Justification: A reference should be checked for its validity before access because an access violation may occur during access.

Importance: High

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_IF

--> SA0145: Possible use of not initialised reference 'ref_iTest'