diff --git a/src/gtk/msgdlg.cpp b/src/gtk/msgdlg.cpp index 755a9fd5d3..9f61be98d7 100644 --- a/src/gtk/msgdlg.cpp +++ b/src/gtk/msgdlg.cpp @@ -39,9 +39,12 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, m_caption = caption; m_message = message; m_dialogStyle = style; - - while (!parent->IsTopLevel()) - parent = parent->GetParent(); + + if (parent) + { + while (!parent->IsTopLevel()) + parent = parent->GetParent(); + } m_parent = parent; } diff --git a/src/gtk1/msgdlg.cpp b/src/gtk1/msgdlg.cpp index 755a9fd5d3..9f61be98d7 100644 --- a/src/gtk1/msgdlg.cpp +++ b/src/gtk1/msgdlg.cpp @@ -39,9 +39,12 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, m_caption = caption; m_message = message; m_dialogStyle = style; - - while (!parent->IsTopLevel()) - parent = parent->GetParent(); + + if (parent) + { + while (!parent->IsTopLevel()) + parent = parent->GetParent(); + } m_parent = parent; }