]> git.mxchange.org Git - flightgear.git/commitdiff
Simon Hollier:
authormfranz <mfranz>
Tue, 10 May 2005 06:26:59 +0000 (06:26 +0000)
committermfranz <mfranz>
Tue, 10 May 2005 06:26:59 +0000 (06:26 +0000)
don't crash when using --disable-splash-screen and/or if font can't be found

src/Main/splash.cxx

index 2f71c4155dd537b16dea3def47ebd6bae098776f..c0bc348c949208d9639a1702584e4177fbb2a24d 100644 (file)
@@ -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);