diff --git a/samples/toolbar/toolbar.cpp b/samples/toolbar/toolbar.cpp index a115521897..5284572c39 100644 --- a/samples/toolbar/toolbar.cpp +++ b/samples/toolbar/toolbar.cpp @@ -587,7 +587,8 @@ void MyFrame::OnToggleAnotherToolbar(wxCommandEvent& WXUNUSED(event)) } else { - long style = GetToolBar()->GetWindowStyle(); + long style = GetToolBar() ? GetToolBar()->GetWindowStyle() + : TOOLBAR_STYLE; style &= ~wxTB_HORIZONTAL; style |= wxTB_VERTICAL;