Hi,

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.
Testing for type!=null in Region.getLabel would prevent even more
problems though, for example, when opening the tile info.
But its ultimately bad, because people would have it easier to
continue playing a broken savegame and loose more time when it
finally does break in some other way.

Next solution would be to regenerate broken data on game load,
but that might be too much work for too few broken savegames and
could still produce a fragile game.

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.


Regards,

wintertime

------------------------------------------------------------------------------
_______________________________________________
Freecol-developers mailing list
Freecol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freecol-developers

Reply via email to