RISCSoftware / cpacs_tigl_gen

Generates CPACS schema based classes for TiGL
Apache License 2.0
5 stars 5 forks source link

Generated code returns Reference to UIDManager which might be null #41

Closed RlanderRISCSW closed 2 years ago

RlanderRISCSW commented 3 years ago

The GetUIDManager functions which are generated for each class return the CTiglUIDManager by reference. In the constructor these classes get the CTiglUIDManager via a pointer which might be NULL. In this case calling the getter would cause dereferencing a null pointer.

bernhardmgruber commented 3 years ago

Instances of the generated CPACS classes were not intended to be used disconnected from a CPACS tree. IIRC I implemented the constructor with the CTiglUIDManager* to allow limited use in unit tests. I think the best you can do is assert or throw in GetUIDManager. Constructing a CPACS class with nullptr for the CTiglUIDManager* is the design flaw here.