Author Topic: Patch: null check in gui theme loading  (Read 1917 times)

0 Members and 1 Guest are viewing this topic.

Offline ArthurDenture

Patch: null check in gui theme loading
« 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.

Offline kierongreen

Re: Patch: null check in gui theme loading
« Reply #1 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?

Offline ArthurDenture

Re: Patch: null check in gui theme loading
« Reply #2 on: November 24, 2013, 09:34:02 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.

Offline Max-Max

Re: Patch: null check in gui theme loading
« Reply #3 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.
- My code doesn't have bugs. It develops random features...

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8799
  • Total likes: 320
  • Helpful: 229
  • Languages: De,EN,JP
Re: Patch: null check in gui theme loading
« Reply #4 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.