Penstock

Guide / Every rule

A step reads a field the variable does not have

The check code/variable-field, in the group Diagrams and code.

AdvicePro

Why it matters

A field the type of a variable does not have is null at runtime, and a misspelt field name is the usual cause. Only a variable whose type is known from the code that sets it is checked, so a field of a type the project does not declare is never reported.

How to fix it

Use a field the type has, or correct the name; a field the code adds later is named in its class.

Where you see it

The Problems tab lists it under Code. In a terminal, penstock code reports it with the file and line. This check is part of Penstock Pro, and Team in a pipeline.

Rule details

Idcode/variable-field
GroupDiagrams and code
LevelAdvice: it works, and reads or runs better without it

Read more: Code links. All rules: Every rule.