On Sun, 2 Aug 2015 21:19:12 +0200 win...@genial.ms wrote: > I thought again about the error handling strategy for BR#2885, > as there are surely some people out there trying to continue > their broken savegame. > > At first I tried to just catch the NPE in MapViewer (git.0129a906) > and this worked surprisingly well for such a simple fix. > I could play several turns without a freeze.
Sooner or later, the null regions will get you. The assumption that Tile.region != null is widespread. The only reliable fix would be to rebuild them at load time. That *might* have been possible, but it would certainly have required some complex code in a fairly sensitive area. I was doubtful it could be made right quickly, and all that time more broken games would be being created. So I made the call to pull 0.11.4. > Something needs to be done though, so I think the best solution > is to simply follow "fail early, fail hard" and check the Region > at load time. Maybe put up a warning dialog if you are inclined > to program one? And call into FreeColClient.fatal to alert people > of the broken savegame. Its slightly more complex than that. On input the reader made some placeholder regions (this is normal practice for many freecol objects as we can not always guarantee they are defined before used), however the placeholders were later (correctly) cleaned up as being undefined, and there was even logging present showing this happening. So it is not quite as simple as checking for null region on read, you have to wait until the dust has settled. However, we *do* have a post-read checkup pass --- you will notice that some objects have a checkIntegrity routine. We could indeed put a null region check into Tile.checkIntegrity. You may ask why we do not already have one? ATM the practice with the checkIntegrity routines is to only check something we can actually fix (the routine might be better named checkAndOptionallyFixIntegrity:-), because there are so many other things we can not. Anyway, starting on the release now. Cheers, Mike Pope
pgpGiU63nSqtQ.pgp
Description: OpenPGP digital signature
------------------------------------------------------------------------------
_______________________________________________ Freecol-developers mailing list Freecol-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freecol-developers