]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix assert in webview sample when viewing pages without a title.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 23 Jul 2012 15:03:09 +0000 (15:03 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 23 Jul 2012 15:03:09 +0000 (15:03 +0000)
Trying to append a menu item with empty label resulted in an assert (at least
under wxGTK but probably elsewhere too), and in any case wasn't very useful,
so use "(untitled)" instead in this case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72174 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/webview/webview.cpp

index de03b11709e4405fd6962e7d324a6e1b312d9f88..e3db1d0451506fa7b6524265ce66ed247ab0de9a 100644 (file)
@@ -641,7 +641,10 @@ void WebFrame::OnToolsClicked(wxCommandEvent& WXUNUSED(evt))
                 wxCommandEventHandler(WebFrame::OnHistory), NULL, this );
     }
 
-    item = m_tools_history_menu->AppendRadioItem(wxID_ANY, m_browser->GetCurrentTitle());
+    wxString title = m_browser->GetCurrentTitle();
+    if ( title.empty() )
+        title = "(untitled)";
+    item = m_tools_history_menu->AppendRadioItem(wxID_ANY, title);
     item->Check();
 
     //No need to connect the current item