The International Simutrans Forum

Development => Patches & Projects => Topic started by: ArthurDenture on November 24, 2013, 08:33:52 PM

Title: Patch: null check in gui theme loading
Post by: ArthurDenture on November 24, 2013, 08:33:52 PM
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.
Title: Re: Patch: null check in gui theme loading
Post by: 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?
Title: Re: Patch: null check in gui theme loading
Post by: ArthurDenture on November 24, 2013, 09:34:02 PM
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.
Title: Re: Patch: null check in gui theme loading
Post by: Max-Max on November 24, 2013, 10:09:22 PM
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.
Title: Re: Patch: null check in gui theme loading
Post by: prissi on November 24, 2013, 10:17:16 PM
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.