From fc2dd9a591c113a2e5881c2ce56cd6303101a383 Mon Sep 17 00:00:00 2001 From: Charlie Groves Date: Tue, 1 Jul 2008 02:13:30 +0000 Subject: [PATCH] If the config coming in to the configurator is causing the interface to hork, try with an empty one in the hopes that the brokenness can be solved with a fresh start. git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@647 c613c5cb-e716-0410-b11b-feb51c14d237 --- .../parlor/game/client/GameConfigurator.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/java/com/threerings/parlor/game/client/GameConfigurator.java b/src/java/com/threerings/parlor/game/client/GameConfigurator.java index 51d59193..2892431f 100644 --- a/src/java/com/threerings/parlor/game/client/GameConfigurator.java +++ b/src/java/com/threerings/parlor/game/client/GameConfigurator.java @@ -21,6 +21,8 @@ package com.threerings.parlor.game.client; +import static com.threerings.parlor.Log.log; + import com.threerings.parlor.game.data.GameConfig; import com.threerings.parlor.util.ParlorContext; @@ -62,7 +64,23 @@ public abstract class GameConfigurator { _config = config; // set up the user interface - gotGameConfig(); + try { + gotGameConfig(); + } catch (RuntimeException re) { + // This config is booched in a way that is unfathomable to our simple GameConfigurator + // ways, but GameConfigs are SimpleStreamables and should be valid when created with + // their default constructors. Try creating one of those to keep things rolling. + log.warning("Unable to fill in interface from config, trying to use a default config", + re); + try { + _config = config.getClass().newInstance(); + } catch (Exception e) { + log.warning("Unable to create replacement game config", "class", e.getClass(), e); + throw re;// Rethrow the original exception since it's a little more relevant + } + // We've got a default config, see how that does + gotGameConfig(); + } } /**