Fix WebView sample when there are blank title pages in history
Otherwise, the wxMenu code asserts due to an empty item.
This commit is contained in:
parent
1622a5c9c2
commit
3ef1aee986
1 changed files with 8 additions and 2 deletions
|
|
@ -1215,7 +1215,10 @@ void WebFrame::OnToolsClicked(wxCommandEvent& WXUNUSED(evt))
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for(i = 0; i < back.size(); i++)
|
for(i = 0; i < back.size(); i++)
|
||||||
{
|
{
|
||||||
item = m_tools_history_menu->AppendRadioItem(wxID_ANY, back[i]->GetTitle());
|
wxString title = back[i]->GetTitle();
|
||||||
|
if ( title.empty() )
|
||||||
|
title = "(untitled)";
|
||||||
|
item = m_tools_history_menu->AppendRadioItem(wxID_ANY, title);
|
||||||
m_histMenuItems[item->GetId()] = back[i];
|
m_histMenuItems[item->GetId()] = back[i];
|
||||||
Bind(wxEVT_MENU, &WebFrame::OnHistory, this, item->GetId());
|
Bind(wxEVT_MENU, &WebFrame::OnHistory, this, item->GetId());
|
||||||
}
|
}
|
||||||
|
|
@ -1231,7 +1234,10 @@ void WebFrame::OnToolsClicked(wxCommandEvent& WXUNUSED(evt))
|
||||||
|
|
||||||
for(i = 0; i < forward.size(); i++)
|
for(i = 0; i < forward.size(); i++)
|
||||||
{
|
{
|
||||||
item = m_tools_history_menu->AppendRadioItem(wxID_ANY, forward[i]->GetTitle());
|
wxString title = forward[i]->GetTitle();
|
||||||
|
if ( title.empty() )
|
||||||
|
title = "(untitled)";
|
||||||
|
item = m_tools_history_menu->AppendRadioItem(wxID_ANY, title);
|
||||||
m_histMenuItems[item->GetId()] = forward[i];
|
m_histMenuItems[item->GetId()] = forward[i];
|
||||||
Bind(wxEVT_TOOL, &WebFrame::OnHistory, this, item->GetId());
|
Bind(wxEVT_TOOL, &WebFrame::OnHistory, this, item->GetId());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue