From df896d168a38f4ab70aee4d07b03553ef6491a6d Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 18 Mar 2005 22:44:47 +0000 Subject: [PATCH] tolerate Register being called before THEME is initialized (like we do with other singletons) --- stepmania/src/ThemeManager.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/stepmania/src/ThemeManager.cpp b/stepmania/src/ThemeManager.cpp index 6df5579c50..a1e59fc6c5 100644 --- a/stepmania/src/ThemeManager.cpp +++ b/stepmania/src/ThemeManager.cpp @@ -882,11 +882,15 @@ public: ADD_METHOD( GetPath ) Luna::Register( L ); - // add global singleton - ASSERT( THEME ); - lua_pushstring(L, "THEME"); - THEME->PushSelf( LUA->L ); - lua_settable(L, LUA_GLOBALSINDEX); + // Add global singleton if constructed already. If it's not constructed yet, + // then we'll register it later when we reinit Lua just before + // initializing the display. + if( THEME ) + { + lua_pushstring(L, "THEME"); + THEME->PushSelf( LUA->L ); + lua_settable(L, LUA_GLOBALSINDEX); + } } };