Skip to content

Static fields not validated correctly #418

@jamesu

Description

@jamesu

Just been backporting some of this code into a tge project. I've noticed In SimObject::setDataField, we have:

         if(array1 >= 0 && array1 < fld->elementCount && fld->elementCount >= 1)
         {
....

            onStaticModified( slotName, value );

            return;
         }
         if(fld->validator)
                  fld->validator->validateType(this, (void *) (((const char *)this) + fld->offset));

The problem is fields will never be validated because in 99% of cases the function will exit at the return. In T3D and other previous versions there is this block before the onStaticModified call:

            if(fld->validator)
               fld->validator->validateType(this, (void *) (((const char *)this) + fld->offset));

I suspect a bad merge may have taken place at one point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions