erase history would crash with empty reslist docsource

This commit is contained in:
dockes 2009-01-28 17:41:31 +00:00
parent a029ca8699
commit 713eb87472
2 changed files with 6 additions and 2 deletions

View File

@ -1062,10 +1062,12 @@ void RclMain::showDocHistory()
void RclMain::eraseDocHistory()
{
// Clear file storage
g_dynconf->eraseAll(RclHistory::docSubkey);
if (g_dynconf)
g_dynconf->eraseAll(RclHistory::docSubkey);
// Clear possibly displayed history
if (resList->displayingHistory())
if (resList->displayingHistory()) {
showDocHistory();
}
}
// Called when the uiprefs dialog is ok'd

View File

@ -178,6 +178,8 @@ bool ResList::displayingHistory()
// We want to reset the displayed history if it is currently
// shown. Using the title value is an ugly hack
string htstring = string((const char *)tr("Document history").utf8());
if (m_docSource.isNull() || m_docSource->title().empty())
return false;
return m_docSource->title().find(htstring) == 0;
}