News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Patch: null check in gui theme loading

Started by ArthurDenture, November 24, 2013, 08:33:52 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ArthurDenture

This replaces a segfault (affecting users running at HEAD who haven't rebuilt their theme) with a fatal error about the theme. Generated at r6934.

kierongreen

While I appreciate this being useful in the short term in the longer term wouldn't this be unnecessary? Or should their be a check for every theme component?

ArthurDenture

Quote from: kierongreen on November 24, 2013, 08:56:57 PM
While I appreciate this being useful in the short term in the longer term wouldn't this be unnecessary? Or should their be a check for every theme component?

You do want missing assets to not result in a segfault, so yes, there should be a check for every theme component if you want to be robust. That might be best done in this same manner inside init_gui_from_images, or it might be bets done inside the code that is supposed to set all those pointers to not be NULL. I don't know enough about the theme system to do a good job on that, so I just fixed the immediate case that caused the recent spate of "game doesn't start" bug reports.

Max-Max

I don't want people to think that I had overlooked this, I just want to make clear that my original system would have taken care of it...
I was told several times that this wasn't necessary because there shouldn't be any missing images in a theme-PAK and if they got outdated, they would be recompiled by the artists ASAP.

It feels good that I'm not the only one thinking that asset validation is a good thing.
- My code doesn't have bugs. It develops random features...

prissi

This will happen only for a short time. When the next stable is release, it will obviously have all files. So failing with a fatal is good enough.