From 713eb87472c626cf1a069f9ffc04c08bfcf13840 Mon Sep 17 00:00:00 2001 From: dockes Date: Wed, 28 Jan 2009 17:41:31 +0000 Subject: [PATCH] erase history would crash with empty reslist docsource --- src/qtgui/rclmain_w.cpp | 6 ++++-- src/qtgui/reslist.cpp | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qtgui/rclmain_w.cpp b/src/qtgui/rclmain_w.cpp index cc69095f..7a37146d 100644 --- a/src/qtgui/rclmain_w.cpp +++ b/src/qtgui/rclmain_w.cpp @@ -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 diff --git a/src/qtgui/reslist.cpp b/src/qtgui/reslist.cpp index 4e5d372f..d5917feb 100644 --- a/src/qtgui/reslist.cpp +++ b/src/qtgui/reslist.cpp @@ -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; }