Browse Source

Add null check to catch faulty MessageBox window layout.

Yao Wei Tjong 姚伟忠 11 years ago
parent
commit
a897ef1651
1 changed files with 2 additions and 0 deletions
  1. 2 0
      Source/Engine/UI/MessageBox.cpp

+ 2 - 0
Source/Engine/UI/MessageBox.cpp

@@ -53,6 +53,8 @@ MessageBox::MessageBox(Context* context, const String& messageString, const Stri
 
     UI* ui = GetSubsystem<UI>();
     window_ = ui->LoadLayout(layoutFile, styleFile);
+    if (!window_)   // Error is already logged
+        return;
     ui->GetRoot()->AddChild(window_);
 
     // Set the title and message strings if they are given