From 51353ead72bf98def9da84b18b3f78b40a5b3123 Mon Sep 17 00:00:00 2001 From: mfranz Date: Tue, 10 May 2005 06:26:59 +0000 Subject: [PATCH] Simon Hollier: don't crash when using --disable-splash-screen and/or if font can't be found --- src/Main/splash.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Main/splash.cxx b/src/Main/splash.cxx index 2f71c4155..c0bc348c9 100644 --- a/src/Main/splash.cxx +++ b/src/Main/splash.cxx @@ -65,9 +65,6 @@ static fntRenderer info; void fgSplashInit ( const char *splash_texture ) { fgRequestRedraw(); - if (!fgGetBool("/sim/startup/splash-screen")) - return; - SG_LOG( SG_GENERAL, SG_INFO, "Initializing splash screen" ); @@ -82,11 +79,16 @@ void fgSplashInit ( const char *splash_texture ) { SGPath path(fontpath); path.append(fontname); - font.load((char *)path.c_str()); + if (!font.load((char *)path.c_str())) { + SG_LOG( SG_GENERAL, SG_ALERT, "Error loading font " << path.str() ); + return; + } info.setFont(&font); info.setPointSize(fontsize); + if (!fgGetBool("/sim/startup/splash-screen")) + return; splash.bind(); @@ -185,7 +187,7 @@ void fgSplashUpdate ( float alpha ) { glEnd(); } - if (progress_text && fgGetBool("/sim/startup/splash-progress", true)) { + if (info.getFont() && progress_text && fgGetBool("/sim/startup/splash-progress", true)) { glEnable(GL_ALPHA_TEST); glEnable(GL_BLEND); glAlphaFunc(GL_GREATER, 0.1f); -- 2.39.5