Closed Piglit closed 1 month ago
I'm quite sure this moves segfaults to other spots, there are quite some places in the code that assume that the template property is set.
Actually it produces quite nice errors and defined behaviour, since objects without templates get deleted in ShipTemplateBasedObject::update:
ERROR: Failed to find ship template: AtlantisXX
ERROR: Failed to find ship template: Adder MK5XX
ERROR: Failed to find ship template:
ERROR: ShipTemplateBasedObject with ID 241 lacked a template, so it was destroyed.
ERROR: Failed to find ship template:
ERROR: ShipTemplateBasedObject with ID 246 lacked a template, so it was destroyed.
In that case, it's mostly fine. There is still a chance that it runs into a crash because other code doing something with the object before the update runs, but those are then extreme edge cases
setTemplate now produces an error, if the chosen template does not exist. But the game no longer crashes with a segfault.